In this template, you must specify your custom hostname. Be sure to change the same hostname in the TLS hosts section.
Template
ingress.yaml
apiVersion:v1kind:Servicemetadata:name:decisionrules-client-servicenamespace:decisionrulesspec:selector:app:decisionrules-clientports: - port:80---apiVersion:v1kind:Servicemetadata:name:decisionrules-server-servicenamespace:decisionrulesspec:selector:app:decisionrules-serverports: - port:8080---apiVersion:networking.k8s.io/v1kind:Ingressmetadata:name:decisionrules-ingressnamespace:decisionrulesannotations:nginx.ingress.kubernetes.io/rewrite-target:"/"cert-manager.io/cluster-issuer:"letsencrypt-prod"spec:ingressClassName:nginxtls: - hosts: - yourdomain.local# must be changed - api.yourdomain.local# must be changedsecretName:echo-tlsrules: - host:yourdomain.local# must be changedhttp:paths: - path:/pathType:Prefixbackend:service:name:decisionrules-client-serviceport:number:80 - host:api.yourdomain.local# must be changedhttp:paths: - path:/pathType:Prefixbackend:service:name:decisionrules-server-serviceport:number:8080
Activate
kubectl apply -f ingress.yaml
6. Getting Ingress IP address for setting domain
Command
kubectl get ingress --namespace=decisionrules
Example of Response
NAME CLASS HOSTS ADDRESS PORTS AGE
decisionrules-ingress nginx kubernetes.decisionrules.io,api.kubernetes.decisionrules.io 104.45.71.23 80, 443 3d23h
In the response, you can find column ADDRESS where you can find the IP Address of Ingress. This IP Address you can use to specify your custom domain as A record of DNS.
7. Create deployment service
In this template, you must fill Environmental variables and change the URL to the Ingress hostname which you specify in the previous step. The place is markup with comments.
Template
deployment.yaml
apiVersion:apps/v1kind:Deploymentmetadata:name:decisionrules-clientnamespace:decisionrulesspec:replicas:2selector:matchLabels:app:decisionrules-clientstrategy:type:RollingUpdaterollingUpdate:maxSurge:2maxUnavailable:0template:metadata:labels:app:decisionrules-clientspec:containers: - name:decisionrules-clientimage:decisionrules/clientresources:requests:cpu:250mmemory:128Milimits:cpu:500mmemory:256Miports: - containerPort:80env: - name:API_URLvalue:"https://api.yourdomain.local"#must be changed---apiVersion:apps/v1kind:Deploymentmetadata:name:decisionrules-servernamespace:decisionrulesspec:replicas:2selector:matchLabels:app:decisionrules-serverstrategy:type:RollingUpdaterollingUpdate:maxSurge:2maxUnavailable:0template:metadata:labels:app:decisionrules-serverspec:containers: - name:decisionrules-serverimage:decisionrules/serverresources:requests:cpu:1000mmemory:1Gilimits:cpu:2000mmemory:2Giports: - containerPort:8080env: - name:REDIS_URLvalue:""# must be filled - name:MONGO_DB_URIvalue:""# must be filled - name:CLIENT_URLvalue:"https://yourdomain.local/#"# must be changed and end with "/#" - name:API_URLvalue:"https://api.yourdomain.local"# this is only necessary with certain deployment models - name:LICENSE_KEYvalue:""# must be filled.yamlstartupProbe:httpGet:path:/health-checkport:8080failureThreshold:20# Application will have 5s+3s*20=65s to startinitialDelaySeconds:5periodSeconds:3livenessProbe:httpGet:path:/health-checkport:8080initialDelaySeconds:10# Is equal to periodSeconds so it does not do anythingfailureThreshold:2# Application will have 2*10s=20s to recover, otherwise it will be killedperiodSeconds:10---apiVersion:autoscaling/v1kind:HorizontalPodAutoscalermetadata:name:decisionrules-server-autoscalingnamespace:decisionrulesspec:scaleTargetRef:apiVersion:apps/v1kind:Deploymentname:decisionrules-serverminReplicas:1maxReplicas:10targetCPUUtilizationPercentage:60