6. K8s Ingress
Routing Rules
Forward Request to internal service

Host
must be valid domain address
map domain name to node's ip address, which is the entrypoint
Configuration in Cluster
We need an implementation for ingress which is an ingress controler
It is a pod which runs on a node inside the cluster which should be installed
Many third party implementations are present but one of K8 is K8s Nginx Ingress Controller
Ingress Controller on Minikube
It automatically starts K8 Nginx implementation of Ingress Controller
minikube addons enable ingress
To verify
kubectl get pod -n kube-system
Config Methods
Method 1
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: dashboard-ingress
spec:
rules:
# Method 1
- host: dashboard.com
http:
paths:
- path: /analytics
backend:
serviceName: analytics-dashboard
servicePort: 80
- path: /shopping
backend:
serviceName: shopping-dashboard
servicePort: 8080
Method 2
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: dashboard-ingress
spec:
rules:
# Method 2
- host: analytics.myapp.com
http:
paths:
backend:
serviceName: analytics-service
servicePort: 3000
- host: shopping.myapp.com
http:
paths:
backend:
serviceName: shopping-service
servicePort: 8080
Configuring TLS Certificate
Data keys need to be tls.crt and tls.key
Values are file content NOT file paths/locations
Secret components must be in same namespace as the ingress component.

Last updated