I have built Kubernetes clusters that consists of four nodes.
But ingress is not reachable from control plane or deployed host.
I tried to deploy services by NodePort then the service is reachable from any node IPs.
My ingress is deployed specific IP address so my Kubernetes is works fine so that I consider my network config has something wrong but I’m not sure.
Application config for each nodes:
ufw allow k8s-worker k8s-calico
ufw allow in vxlan.calico
ufw allow out vxlan.calico
ufw allow k8s-pods from 192.168.0.60/30
ufw allow k8s-nginx-ingress from 192.168.0.60/30
Detail application config:
# For control plane
[k8s-cp]
title=Kubernetes for control plane
description=Kubernetes for control plane
ports=80,443,2379,2380,6443,10250:10252,10259,10257,30000:32767/tcp
# For worker node
[k8s-worker]
title=Kubernetes for worker node
description=Kubernetes worker node
ports=80,443,10250,30000:32767/tcp
# Common config
[k8s-calico]
title=callico
description=callico for kubernetes CNI
ports=47,179/tcp|4789/udp|2379/tcp
[k8s-pods]
title=Kubernetes Pods Communication
description=Allow traffic from Kubernetes pods within the CIDR range.
ports=1:65535/tcp|1:65535/udp
[k8s-nginx-ingress]
title=Kubernetes Nginx Ingress Controller
description=Kubernetes Nginx Ingress Controller
ports=8443/tcp
Deployments:
apiVersion: v1
kind: Namespace
metadata:
name: nginx-test
labels:
name: nginx-test
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
namespace: nginx-test
spec:
selector:
matchLabels:
app: nginx
replicas: 2
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
resources:
requests:
memory: "128Mi"
cpu: "0.1"
limits:
memory: "128Mi"
cpu: "0.1"
---
apiVersion: v1
kind: Service
metadata:
name: nginx-service
namespace: nginx-test
labels:
app: nginx
spec:
type: ClusterIP
ports:
- name: http
port: 8080
targetPort: 80
protocol: TCP
selector:
app: nginx
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-test
namespace: nginx-test
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
labels:
app: nginx
spec:
ingressClassName: nginx
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: nginx-service
port:
number: 8080
host: sparrow03.local
The ingress status:
Name: ingress-test
Labels: app=nginx
Namespace: nginx-test
Address: 192.168.0.63
Ingress Class: nginx
Default backend: <default>
Rules:
Host Path Backends
---- ---- --------
sparrow03.local
/ nginx-service:8080 (172.16.184.3:80,172.16.214.3:80)
Annotations: nginx.ingress.kubernetes.io/rewrite-target: /
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Sync 4m12s (x3 over 5m3s) nginx-ingress-controller Scheduled for sync
There is a specification of each node.
- OS: Ubuntu 22.04
- Kubernetes: 1.29.3
- CRI: containerd
- CNI: Calico
- Ingress class: nginx
- Hardware: Raspberry Pi 4