2020-02-28 14:53:24 +00:00
The ingress-nginx controller has been installed.
2020-02-24 19:25:57 +00:00
{{- if contains "NodePort" .Values.controller.service.type }}
Get the application URL by running these commands:
{{- if (not (empty .Values.controller.service.nodePorts.http)) }}
export HTTP_NODE_PORT={{ .Values.controller.service.nodePorts.http }}
{{- else }}
2023-11-07 17:46:40 +00:00
export HTTP_NODE_PORT=$(kubectl get service --namespace {{ include "ingress-nginx.namespace" . }} {{ include "ingress-nginx.controller.fullname" . }} --output jsonpath="{.spec.ports[0].nodePort}")
2020-02-24 19:25:57 +00:00
{{- end }}
{{- if (not (empty .Values.controller.service.nodePorts.https)) }}
export HTTPS_NODE_PORT={{ .Values.controller.service.nodePorts.https }}
{{- else }}
2023-11-07 17:46:40 +00:00
export HTTPS_NODE_PORT=$(kubectl get service --namespace {{ include "ingress-nginx.namespace" . }} {{ include "ingress-nginx.controller.fullname" . }} --output jsonpath="{.spec.ports[1].nodePort}")
2020-02-24 19:25:57 +00:00
{{- end }}
2023-11-07 17:46:40 +00:00
export NODE_IP="$(kubectl get nodes --output jsonpath="{.items[0].status.addresses[1].address}")"
2020-02-24 19:25:57 +00:00
2023-11-07 17:46:40 +00:00
echo "Visit http://${NODE_IP}:${HTTP_NODE_PORT} to access your application via HTTP."
echo "Visit https://${NODE_IP}:${HTTPS_NODE_PORT} to access your application via HTTPS."
2020-02-24 19:25:57 +00:00
{{- else if contains "LoadBalancer" .Values.controller.service.type }}
2023-11-07 17:46:40 +00:00
It may take a few minutes for the load balancer IP to be available.
You can watch the status by running 'kubectl get service --namespace {{ include "ingress-nginx.namespace" . }} {{ include "ingress-nginx.controller.fullname" . }} --output wide --watch'
2020-02-24 19:25:57 +00:00
{{- else if contains "ClusterIP" .Values.controller.service.type }}
Get the application URL by running these commands:
2023-11-07 17:46:40 +00:00
export POD_NAME="$(kubectl get pods --namespace {{ include "ingress-nginx.namespace" . }} --selector app.kubernetes.io/name={{ include "ingress-nginx.name" . }},app.kubernetes.io/instance={{ .Release.Name }},app.kubernetes.io/component=controller --output jsonpath="{.items[0].metadata.name}")"
kubectl port-forward --namespace {{ include "ingress-nginx.namespace" . }} "${POD_NAME}" 8080:80
2020-02-24 19:25:57 +00:00
echo "Visit http://127.0.0.1:8080 to access your application."
{{- end }}
An example Ingress that makes use of the controller:
2021-11-09 15:43:49 +00:00
{{- $isV1 := semverCompare ">=1" .Chart.AppVersion}}
2021-08-21 20:42:00 +00:00
apiVersion: networking.k8s.io/v1
2020-02-24 19:25:57 +00:00
kind: Ingress
metadata:
name: example
namespace: foo
2021-11-09 15:43:49 +00:00
{{- if eq $isV1 false }}
annotations:
kubernetes.io/ingress.class: {{ .Values.controller.ingressClass }}
{{- end }}
2020-02-24 19:25:57 +00:00
spec:
2021-11-09 15:43:49 +00:00
{{- if $isV1 }}
ingressClassName: {{ .Values.controller.ingressClassResource.name }}
{{- end }}
2020-02-24 19:25:57 +00:00
rules:
- host: www.example.com
http:
paths:
2022-02-20 21:14:11 +00:00
- pathType: Prefix
backend:
2021-10-12 02:39:47 +00:00
service:
name: exampleService
2021-11-09 15:43:49 +00:00
port:
number: 80
path: /
2020-02-24 19:25:57 +00:00
# This section is only required if TLS is to be enabled for the Ingress
tls:
2021-10-12 02:39:47 +00:00
- hosts:
- www.example.com
secretName: example-tls
2020-02-24 19:25:57 +00:00
If TLS is enabled for the Ingress, a Secret containing the certificate and key must also be provided:
apiVersion: v1
kind: Secret
metadata:
name: example-tls
namespace: foo
data:
tls.crt: <base64 encoded cert>
tls.key: <base64 encoded key>
type: kubernetes.io/tls