An ingress is a Kubernetes object who will allow you to route external access to an internal service. Nginx-ingress and ingress-nginx are both based on Nginx. Nginx-ingress is a popular ingress controller, it uses a ConfigMap to configure Nginx. It has been recently been deprecated in favor of the Kubernetes community chart ingress-nginx.
What are the differences?
- Different repository for the Helm chart
- Different configuration file
Let’s migrate
Add the Ingress-nginx repository
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
Get your ConfigMap, this is just an example, adapt it to your usecase.
kind: ConfigMap
apiVersion: v1
metadata:
name: nginx-ingress-controller
namespace: nginx-ingress
labels:
app.kubernetes.io/name: nginx-ingress
app.kubernetes.io/part-of: nginx-ingress
data:
proxy-protocol: "True"
use-proxy-protocol: "True"
real-ip-header: "proxy_protocol"
ssl-protocols: "TLSv1.3 TLSv1.2"
Merge it in your configuration file, in controller.config. I have removed the TLS version, TLSv1.3 is now the default value.
controller:
config: {
proxy-protocol: "True",
use-proxy-protocol: "True",
real-ip-header: "proxy_protocol"
}
service:
annotations:
metallb.universe.tf/address-pool: nginx-ingress
nginx.ingress.kubernetes.io/proxy-body-size: 8m
externalTrafficPolicy: Local
Migration
With MetalLB
If like me you have determined an IP who will be used by the Load Balancer, the easiest way is to uninstall nginx-ingress and install ingress-nginx. The down time will be low, and you don’t have any extra configuration to do.
I use the nginx-ingress namespace and nginx-ingress as name too.
helm -n nginx-ingress uninstall nginx-ingress
helm install nginx-ingress ingress-nginx/ingress-nginx --namespace nginx-ingress -f nginx-values.yaml
With a Cloud provider
We will realize the operation in three parts:
- Install ingress-nginx, to create the new Load Balancer
- Redirect the domains to the new Load Balancer
- Remove nginx-ingress
Install ingress-nginx
helm install nginx-ingress ingress-nginx/ingress-nginx --namespace nginx-ingress -f nginx-values.yaml
The Load balancer will be provisioned by your Cloud Provider. You can get its IP or domain name (depending of the provider) using kubectl.
kubectl -n nginx-ingress get svc -o wide
Redirect your DNS to the new Load balancer. Wait the DNS propagation, and remove the old chart.
helm -n nginx-ingress uninstall nginx-ingress
Conclusion
We have migrated from nginx-ingress to ingress-nginx, with a minimum of downtime. This one looks more flexible and it’s easier to have only one configuration file.