Ingress-nginx

From UVOO Tech Wiki
Revision as of 02:29, 27 May 2022 by Busk (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

https://microk8s.io/docs/addon-ingress

https://platform9.com/blog/ultimate-guide-to-kubernetes-ingress-controllers/

https://kubernetes.github.io/ingress-nginx/user-guide/exposing-tcp-udp-services/

https://github.com/kubernetes/ingress-nginx/blob/main/docs/examples/rewrite/README.md

https://docs.nginx.com/nginx-ingress-controller/configuration/ingress-resources/advanced-configuration-with-annotations/

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"

Match Header

https://stackoverflow.com/questions/53674200/kubernetes-ingress-conditional-routing

https://github.com/Shopify/ingress/blob/master/docs/user-guide/nginx-configuration/annotations.md#server-snippet

https://docs.nginx.com/nginx-ingress-controller/configuration/ingress-resources/advanced-configuration-with-snippets/

https://stackoverflow.com/questions/54083179/how-can-i-correctly-setup-custom-headers-with-nginx-ingress

Working on Exploring

https://stackoverflow.com/questions/61430311/exposing-multiple-tcp-udp-services-using-a-single-loadbalancer-on-k8s

https://stackoverflow.com/questions/37221483/service-located-in-another-namespace

https://stackoverflow.com/questions/53858277/kubernetes-ingress-routes-with-url-parameter

Externa

External URL Proxy

https://stackoverflow.com/questions/68687814/ingress-nginx-proxy-to-external-url

nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
nginx.ingress.kubernetes.io/upstream-vhost: "url-ext.com"

Microk8s view logs

kubectl -n ingress logs -f -l name=nginx-ingress-microk8s

foo

apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-ingress-tcp-microk8s-conf
  namespace: ingress
data:
  29418: "yournamespace/yourservicename:yourserviceport"

What is - https://medium.com/google-cloud/kubernetes-nodeport-vs-loadbalancer-vs-ingress-when-should-i-use-what-922f010849e0