Skip to content

Latest commit

 

History

History
47 lines (42 loc) · 1.22 KB

2.INGRESS.md

File metadata and controls

47 lines (42 loc) · 1.22 KB

SETUP INGRESS CONTROLLER

Install Helm

curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh

Install HAProxy Ingress-controller

helm repo add haproxytech https://haproxytech.github.io/helm-charts
helm repo update
helm install haproxy-kubernetes-ingress haproxytech/kubernetes-ingress   --create-namespace   --namespace haproxy-controller

Get nodeport of Ingress controller

kubectl get svc haproxy-kubernetes-ingress -n haproxy-controller

In Column PORT(S), they are the nodeports equivalent to the local port

Create Ingress for services

  1. First make sure there is a ClusterIP service for the pod - ex: app-service
  2. Create Ingress with ingressClassName: haproxy
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: app-ingress
  annotations:
    haproxy.org/path-rewrite: /
spec:
  ingressClassName: haproxy
  rules:
  - http:
      paths:
      - path: /example
        pathType: Prefix
        backend:
          service:
            name: app-service
            port:
              number: 80
  1. Now you can access the pod application through <ANY_NODE_IP>:<NODE_PORT>/example