in

Nodeport not working


Hello, just getting started with kubernetes and tried nginx deployment but can not get any further than creating pods. Below is the cluster information:

Cluster information:

Kubernetes version: 1.23
Cloud being used: baremetal
Installation method: kubeadm (How to Install Kubernetes on Ubuntu 20.04 – Hiberstack ) followed this link
Host OS: Ubuntu 20
CNI and version: flannel 0.15.1
CRI and version:

Tried running nginx on the cluster, pods and service are running but unable to get to the nginx welcome page on any ip or port.

deployment file –


apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 2
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
        - name: nginx
          image: nginx:1.14.2
        ports:
          - containerPort: 80
Service file -
apiVersion: v1
kind: Service
metadata:
  name: nginx
spec:
  type: NodePort
  ports:
    - port: 80
      targetPort: 80
      nodePort: 30005
  selector:
    app: nginx

kubectl describe svc nginx
Name: nginx
Namespace: default
Labels:
Annotations:
Selector: app=nginx
Type: NodePort
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.111.246.112
IPs: 10.111.246.112
Port: 80/TCP
TargetPort: 80/TCP
NodePort: 30005/TCP
Endpoints: 192.168.1.2:80,192.168.1.3:80
Session Affinity: None
External Traffic Policy: Cluster
Events:

curl on the endpoint, node private or public ip with the port 80 or 30005 does not return anything. It seems like I have not configured things properly since there is no output on any ip but can not figure out what.

1 post – 1 participant

Read full topic



Source: https://discuss.kubernetes.io/t/nodeport-not-working/18619

How Apple Watch is Saving Life of Its Users

Simple CRUD API written in Go, built using AWS SAM tool and using the AWS’ infrastructure