Hi,
We have a k8s cluster in my team with one master node (1) and three worker nodes(2,3,4).
One of my colleagues deploy his service (nodePort type) in node 1 (with nodeport 30700), and this master node schedules the pod to node 2. we can this service using the master node address with nodeport(192.168.10.1:30700) . When I deployed my service in node 1 (nodePort type), it scheduled the pod to node 3 (with nodeport 30900). If I call the service using the master node address with nodeport(192.168.10.1:30900), I can reach the service. However, if I use the node 3 address (192.168.10.3), everything is fine.
Am I missing something here? I check the ingress-nginx-controller.yaml which used to set up the k8s cluster, in one of the sections:
apiVersion: v1
kind: Service
metadata:
annotations:
labels:
helm.sh/chart: ingress-nginx-4.0.6
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/version: 1.0.4
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: controller
name: ingress-nginx-controller
namespace: ingress-nginx
spec:
# optional
externalIPs:
# List of exposed IPs to access cluster services
- 192.168.10.1
- 192.168.10.2
# This will make NodePort and the Service port both available
# $ curl -D- http://myapp.example.com:30100
# HTTP/1.1 200 OK
# Server: nginx/1.15.2
# $ curl -D- http://myapp.example.com
# HTTP/1.1 200 OK
# Server: nginx/1.15.2
type: NodePort
ipFamilyPolicy: SingleStack
ipFamilies:
- IPv4
ports:
- name: http
port: 80
protocol: TCP
targetPort: http
appProtocol: http
- name: https
port: 443
protocol: TCP
targetPort: https
appProtocol: https
selector:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/component: controller
They add the worker nodes 3 and 4 later((not the time when setting up the master 1 and worker 1)) and may not change this file, so it still has - 192.168.10.1 and - 192.168.10.2.
Thanks
Cluster information:
Kubernetes version:
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.3", GitCommit:"816c97ab8cff8a1c72eccca1026f7820e93e0d25", GitTreeState:"clean", BuildDate:"2022-01-25T21:25:17Z", GoVersion:"go1.17.6", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.4", GitCommit:"b695d79d4f967c403a96986f1750a35eb75e75f1", GitTreeState:"clean", BuildDate:"2021-11-17T15:42:41Z", GoVersion:"go1.16.10", Compiler:"gc", Platform:"linux/amd64"}
Cloud being used: bare-metal
Installation method: apt-get install
Host OS: Ubuntu 20.04.3 LTS