ckad icon indicating copy to clipboard operation
ckad copied to clipboard

Issue with 2/Application Deployment 2/Use Kubernetes Primitives

Open Rasputin2 opened this issue 1 year ago • 1 comments

Hello: Love the course. Question, however. I am in 2/Application Deployment and 2/Use Kubernetes Primitives. I tried the commands for Task 1 shown in the answers, and this is a description of the service (see below). But when I try curl http://localhost:<Node Port> I get connection refused. I tried http and https. I also tried including the whole ip address and not just the node port. Am I missing something? Am I supposed to create a shell INTO the pod or something before I run the curl?

Name: nginx-svc Namespace: ckad Labels: app=nginx-deploy Annotations: Selector: app=nginx-deploy Type: NodePort IP Family Policy: SingleStack IP Families: IPv4 IP: 10.107.49.104 IPs: 10.107.49.104 Port: 9000/TCP TargetPort: 80/TCP NodePort: 32543/TCP Endpoints: 10.244.0.36:80,10.244.0.37:80,10.244.0.38:80 + 1 more... Session Affinity: None External Traffic Policy: Cluster Events:

Is it obvious what I am doing wrong?

Rasputin2 avatar Nov 02 '23 23:11 Rasputin2

Same for me ! As it is a NodePort service type the service is not accessible from the outside (I guess). After changing it to LoadBalancer it worked !

kubectl expose deploy nginx-deploy --port=9000 --target-port=80 --type=LoadBalancer --name=nginx-svc

Then

curl localhost:9000 and you should see the HTML

ChrisProlls avatar Mar 19 '24 20:03 ChrisProlls