Kubernetes ingress controller use nginx - unix1998/technical_notes GitHub Wiki
In Kubernetes, an Ingress controller is necessary to manage Ingress resources and provide HTTP and HTTPS routing to services within the cluster. The Ingress controller is not installed by default in a Kubernetes cluster. You need to install and configure an Ingress controller to manage Ingress resources.
Common Ingress Controllers for Kubernetes
Here are some of the most commonly used Ingress controllers in Kubernetes:
-
NGINX Ingress Controller:
- One of the most widely used Ingress controllers.
- Maintained by the Kubernetes community.
- Supports a wide range of features and configurations.
-
Traefik:
- A dynamic, modern reverse proxy and load balancer.
- Supports a wide range of configurations and integrates well with Kubernetes.
-
HAProxy Ingress:
- Uses HAProxy as the load balancer.
- Known for its performance and reliability.
-
Contour:
- An Envoy-based Ingress controller.
- Focuses on simplicity and robustness.
-
GCE Ingress:
- Specific to Google Kubernetes Engine (GKE).
- Uses Google Cloud Load Balancing.
-
Istio:
- A service mesh that includes an Ingress gateway for managing external access.
Installing an Ingress Controller
To install an NGINX Ingress Controller, for example, you can follow these steps:
-
Install the NGINX Ingress Controller using Helm:
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx helm repo update helm install nginx-ingress ingress-nginx/ingress-nginx
Alternatively, you can install it using a manifest file:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/cloud/deploy.yaml
-
Verify the Installation: Check that the Ingress controller pods are running:
kubectl get pods -n ingress-nginx
-
Create an Ingress Resource: Define an Ingress resource to route traffic to your service:
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: example-ingress namespace: default annotations: nginx.ingress.kubernetes.io/rewrite-target: / spec: rules: - host: example.com http: paths: - path: / pathType: Prefix backend: service: name: example-service port: number: 80
Apply the Ingress resource:
kubectl apply -f example-ingress.yaml
Configuring DNS
After setting up the Ingress controller and resources, you need to configure your DNS to point to the external IP address of the Ingress controller. For example, you can create a DNS record for example.com
pointing to the IP address.
Conclusion
There is no default Ingress controller in a standard Kubernetes installation. You need to choose and install one based on your requirements. The NGINX Ingress Controller is a popular choice and can be easily installed and configured using Helm or manifest files.