Mohammed Naser | 9ad0d46 | 2023-01-15 20:36:37 -0500 | [diff] [blame] | 1 | The ingress-nginx controller has been installed. |
| 2 | |
| 3 | {{- if contains "NodePort" .Values.controller.service.type }} |
| 4 | Get the application URL by running these commands: |
| 5 | |
| 6 | {{- if (not (empty .Values.controller.service.nodePorts.http)) }} |
| 7 | export HTTP_NODE_PORT={{ .Values.controller.service.nodePorts.http }} |
| 8 | {{- else }} |
| 9 | export HTTP_NODE_PORT=$(kubectl --namespace {{ .Release.Namespace }} get services -o jsonpath="{.spec.ports[0].nodePort}" {{ include "ingress-nginx.controller.fullname" . }}) |
| 10 | {{- end }} |
| 11 | {{- if (not (empty .Values.controller.service.nodePorts.https)) }} |
| 12 | export HTTPS_NODE_PORT={{ .Values.controller.service.nodePorts.https }} |
| 13 | {{- else }} |
| 14 | export HTTPS_NODE_PORT=$(kubectl --namespace {{ .Release.Namespace }} get services -o jsonpath="{.spec.ports[1].nodePort}" {{ include "ingress-nginx.controller.fullname" . }}) |
| 15 | {{- end }} |
| 16 | export NODE_IP=$(kubectl --namespace {{ .Release.Namespace }} get nodes -o jsonpath="{.items[0].status.addresses[1].address}") |
| 17 | |
| 18 | echo "Visit http://$NODE_IP:$HTTP_NODE_PORT to access your application via HTTP." |
| 19 | echo "Visit https://$NODE_IP:$HTTPS_NODE_PORT to access your application via HTTPS." |
| 20 | {{- else if contains "LoadBalancer" .Values.controller.service.type }} |
| 21 | It may take a few minutes for the LoadBalancer IP to be available. |
| 22 | You can watch the status by running 'kubectl --namespace {{ .Release.Namespace }} get services -o wide -w {{ include "ingress-nginx.controller.fullname" . }}' |
| 23 | {{- else if contains "ClusterIP" .Values.controller.service.type }} |
| 24 | Get the application URL by running these commands: |
| 25 | export POD_NAME=$(kubectl --namespace {{ .Release.Namespace }} get pods -o jsonpath="{.items[0].metadata.name}" -l "app={{ template "ingress-nginx.name" . }},component={{ .Values.controller.name }},release={{ .Release.Name }}") |
| 26 | kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 |
| 27 | echo "Visit http://127.0.0.1:8080 to access your application." |
| 28 | {{- end }} |
| 29 | |
| 30 | An example Ingress that makes use of the controller: |
| 31 | |
| 32 | {{- $isV1 := semverCompare ">=1" .Chart.AppVersion}} |
| 33 | apiVersion: networking.k8s.io/v1 |
| 34 | kind: Ingress |
| 35 | metadata: |
| 36 | name: example |
| 37 | namespace: foo |
| 38 | {{- if eq $isV1 false }} |
| 39 | annotations: |
| 40 | kubernetes.io/ingress.class: {{ .Values.controller.ingressClass }} |
| 41 | {{- end }} |
| 42 | spec: |
| 43 | {{- if $isV1 }} |
| 44 | ingressClassName: {{ .Values.controller.ingressClassResource.name }} |
| 45 | {{- end }} |
| 46 | rules: |
| 47 | - host: www.example.com |
| 48 | http: |
| 49 | paths: |
| 50 | - backend: |
| 51 | service: |
| 52 | name: exampleService |
| 53 | port: |
| 54 | number: 80 |
| 55 | path: / |
| 56 | # This section is only required if TLS is to be enabled for the Ingress |
| 57 | tls: |
| 58 | - hosts: |
| 59 | - www.example.com |
| 60 | secretName: example-tls |
| 61 | |
| 62 | If TLS is enabled for the Ingress, a Secret containing the certificate and key must also be provided: |
| 63 | |
| 64 | apiVersion: v1 |
| 65 | kind: Secret |
| 66 | metadata: |
| 67 | name: example-tls |
| 68 | namespace: foo |
| 69 | data: |
| 70 | tls.crt: <base64 encoded cert> |
| 71 | tls.key: <base64 encoded key> |
| 72 | type: kubernetes.io/tls |
| 73 | |
| 74 | {{- if .Values.controller.headers }} |
| 75 | ################################################################################# |
| 76 | ###### WARNING: `controller.headers` has been deprecated! ##### |
| 77 | ###### It has been renamed to `controller.proxySetHeaders`. ##### |
| 78 | ################################################################################# |
| 79 | {{- end }} |