Create an ingress
To create an ingress for each public:
-
Log in into your rancher account and click the "Import YAML" button:
-
From the Import YAML screen, enter the following to create the service:
apiVersion: v1 kind: Service metadata: name: esservices-dev-magnolia-helm-public-svc-0 (1) namespace: esservices-dev (2) spec: clusterIP: None clusterIPs: - None ports: - name: tomcat port: 8080 targetPort: 8080 selector: statefulset.kubernetes.io/pod-name: esservices-dev-magnolia-helm-public-0 (3)
1 Give a name
to the service.2 Specify the namespace
to create the service.3 The name of your public pod. -
Then, you need to create the ingress.
Again you need to import a new
yaml
with the Import YAML screen:apiVersion: networking.k8s.io/v1 kind: Ingress metadata: annotations: kubernetes.io/ingress.class: "nginx" nginx.ingress.kubernetes.io/proxy-body-size: 512m cert-manager.io/cluster-issuer: "letsencrypt-prod" nginx.ingress.kubernetes.io/configuration-snippet: | more_set_headers "X-Robots-Tag: noindex, nofollow"; more_set_headers "X-Upstream $upstream_addr"; name: public-0 (1) namespace: esservices-dev (2) spec: rules: - host: public-0.esservices-dev.eu-playground.magnolia-platform.com (3) http: paths: - backend: service: name: esservices-dev-magnolia-helm-public-svc-0 (4) port: name: tomcat path: / pathType: ImplementationSpecific tls: - hosts: - public-0.esservices-dev.eu-playground.magnolia-platform.com (3) secretName: public-0.esservices-dev.eu-playground.magnolia-platform.com (5)
1 Name of the ingress: you should give a name for the ingress. 2 Namespace: namespace to create the ingress. 3 Host: host to access to the specific public. 4 Name of the service: it must be equal to the one created in the previous step. 5 Secret Name: secret for access to the public.
An ingress is born!
Now, you can see the services created with the urls for each public. You just need to repeat the previous steps for your other public(s).
