Hi, I am setting up my first kubernates cluster using kind. I had setup my cluster and also service with type as nodeport. Below is my configuration for deployment and service.
apiVersion: apps/v1
kind: Deployment
metadata:
name: testdeployment
labels:
app: firstkubernatestest
spec:
selector:
matchLabels:
app: firstkubernatestest
replicas: 4
template:
metadata:
labels:
app: firstkubernatestest
spec:
containers:
- name: mynginxcontanier
image: nginx
ports:
- name: firstport
containerPort: 80
apiVersion: v1
kind: Service
metadata:
name: testservice
labels:
app: firstkubernatestest
spec:
selector:
app: firstkubernatestest
type: NodePort
ports:
- nodePort: 31000
port: 80
targetPort: 80
Below is the output of the service.
kubectl get service -l app=firstkubernatestest
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
testservice NodePort 10.96.184.218 80:31000/TCP 17m
When I try to access the service using
curl http://10.96.184.218:80
I am getting TimedOut Exception. Can anyone please let me know, what is the issue ?