After creating a deployment for a web-application, consisting of pod, internal service and ingress, the ingress can't be created. When executing kubectl apply -f web-app.yaml
, I get the error:
error when creating "web-app.yaml": Internal error occurred: failed calling webhook "validate.nginx.ingress.kubernetes.io": Post "https://ingress-nginx-controller-admission.ingress-nginx.svc:443/networking/v1/ingresses?timeout=10s": dial tcp 10.100.7.97:443: connect: no route to host
After some retries, it worked surprisingly, but after some changes to the deployment, the same error occurs again.
web-app.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-app
namespace: development
spec:
replicas: 1
selector:
matchLabels:
app: web-app
template:
metadata:
labels:
app: web-app
spec:
containers:
- name: web-app
image: registry/web-app:latest
resources:
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: web-app-internal
namespace: development
spec:
selector:
app: web-app
ports:
- port: 8080
targetPort: 8080
protocol: TCP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: "nginx"
name: web-app-ingress
namespace: development
labels:
name: web-app-ingress
spec:
rules:
- host: web.app
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: web-app-internal
port:
number: 8080
Any clues what the issue could be?