- Run docker build
docker build -t some_tag --build-arg REDIRECT_URL=https://some-url.com .
- Push image to registry
docker push some_registry/k8s-custom-default-backend:some_tag
- Delete template from content folder
- Place index.html and related css/js files in content folder
- Remove lines 1 through 19 inclusive in Dockerfile
- Replace the new line 12 with
COPY ./content /var/www/html/
in Dockerfile - Run docker build
docker build -t some_tag .
- Push image to registry
docker push some_registry/k8s-custom-default-backend:some_tag
- Create manifest (custom_default_backend.yaml)
---
apiVersion: v1
kind: Service
metadata:
name: custom-default-backend
namespace: ingress-nginx
labels:
app.kubernetes.io/name: custom-default-backend
app.kubernetes.io/part-of: ingress-nginx
spec:
selector:
app.kubernetes.io/name: custom-default-backend
app.kubernetes.io/part-of: ingress-nginx
ports:
- port: 80
targetPort: 80
name: http
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: custom-default-backend
namespace: ingress-nginx
labels:
app.kubernetes.io/name: custom-default-backend
app.kubernetes.io/part-of: ingress-nginx
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: custom-default-backend
app.kubernetes.io/part-of: ingress-nginx
template:
metadata:
labels:
app.kubernetes.io/name: custom-default-backend
app.kubernetes.io/part-of: ingress-nginx
spec:
containers:
- name: custom-default-backend
image: registry/k8s-custom-default-backend:some_tag
imagePullPolicy: Always
ports:
- containerPort: 80
- Kubectl create the manifest
kubectl create -f custom_default_backend.yaml
- Delete previous Nginx Ingress Controller Helm installation
helm delete nginx-ingress -n ingress-nginx
- Reinstall
helm install nginx-ingress --namespace kube-system ingress-nginx/ingress-nginx --set defaultBackend.enabled=false,controller.defaultBackendService=ingress-nginx/custom-default-backend
Please consider supporting my projects, the more caffine I have, the quicker I can type.