Difference between revisions of "Ingress-nginx"
Jump to navigation
Jump to search
Line 12: | Line 12: | ||
apk add bind-tools curl | apk add bind-tools curl | ||
host ingress-nginx-controller.ingress-nginx.svc.cluster.local | host ingress-nginx-controller.ingress-nginx.svc.cluster.local | ||
+ | ``` | ||
+ | |||
+ | Keys | ||
+ | ``` | ||
+ | --- | ||
+ | apiVersion: v1 | ||
+ | kind: Secret | ||
+ | metadata: | ||
+ | name: tls-monitor-example-com | ||
+ | type: kubernetes.io/tls | ||
+ | data: | ||
+ | tls.crt: "mybase64encoded crt" | ||
+ | tls.key: "mybase64encoded key" | ||
+ | ``` | ||
+ | |||
+ | |||
+ | Example of ingress.yml | ||
+ | ``` | ||
+ | apiVersion: networking.k8s.io/v1 | ||
+ | kind: Ingress | ||
+ | metadata: | ||
+ | name: ingress-nginx | ||
+ | annotations: | ||
+ | nginx.ingress.kubernetes.io/rewrite-target: / | ||
+ | spec: | ||
+ | tls: | ||
+ | - hosts: | ||
+ | - monitor.example-com | ||
+ | secretName: tls-monitor-example.com | ||
+ | rules: | ||
+ | - host: monitor.example.com | ||
+ | http: | ||
+ | paths: | ||
+ | - path: / | ||
+ | pathType: Prefix | ||
+ | backend: | ||
+ | service: | ||
+ | name: zabbix-web | ||
+ | port: | ||
+ | number: 8080 | ||
+ | --- | ||
+ | apiVersion: v1 | ||
+ | kind: ConfigMap | ||
+ | metadata: | ||
+ | name: tcp-services | ||
+ | namespace: ingress-nginx | ||
+ | data: | ||
+ | 10051: "zabbix/zabbix-server:10051" | ||
+ | --- | ||
+ | apiVersion: v1 | ||
+ | kind: ConfigMap | ||
+ | metadata: | ||
+ | name: udp-services | ||
+ | namespace: ingress-nginx | ||
+ | data: | ||
+ | 162: "zabbix/zabbix-server:162" | ||
``` | ``` |
Revision as of 16:40, 13 October 2021
https://kubernetes.github.io/ingress-nginx/user-guide/exposing-tcp-udp-services/
Install
kubectl create namespace ingress-nginx helm install --namespace ingress-nginx ingress-nginx ingress-nginx/ingress-nginx
Testing
kubectl run my-test-container --image=alpine -it --rm -- /bin/sh apk add bind-tools curl host ingress-nginx-controller.ingress-nginx.svc.cluster.local
Keys
--- apiVersion: v1 kind: Secret metadata: name: tls-monitor-example-com type: kubernetes.io/tls data: tls.crt: "mybase64encoded crt" tls.key: "mybase64encoded key"
Example of ingress.yml
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: ingress-nginx annotations: nginx.ingress.kubernetes.io/rewrite-target: / spec: tls: - hosts: - monitor.example-com secretName: tls-monitor-example.com rules: - host: monitor.example.com http: paths: - path: / pathType: Prefix backend: service: name: zabbix-web port: number: 8080 --- apiVersion: v1 kind: ConfigMap metadata: name: tcp-services namespace: ingress-nginx data: 10051: "zabbix/zabbix-server:10051" --- apiVersion: v1 kind: ConfigMap metadata: name: udp-services namespace: ingress-nginx data: 162: "zabbix/zabbix-server:162"