I have deployed and exposed Nginx with the following commands:
sudo kubectl create deployment mynginx1 --image=nginx
sudo kubectl expose deployment mynginx1 --type NodePort --port 8080
I access using http://: or http://172.17.135.42:31788
But I am getting Error 404. Help appreciated.
gtan@master:~$ kubectl get pods -owide -A NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES default mynginx1-f544c49cb-g92w2 1/1 Running 0 3m19s 172.168.10.2 slave1 kube-system coredns-66bff467f8-92r4n 1/1 Running 0 7m56s 172.168.10.2 master kube-system coredns-66bff467f8-gc7tc 1/1 Running 0 7m56s 172.168.10.3 master kube-system etcd-master 1/1 Running 0 8m6s 172.17.82.100 master kube-system kube-apiserver-master 1/1 Running 0 8m6s 172.17.82.100 master kube-system kube-controller-manager-master 1/1 Running 0 8m6s 172.17.82.100 master kube-system kube-flannel-ds-amd64-24pwc 1/1 Running 3 4m58s 172.17.82.110 slave1 kube-system kube-flannel-ds-amd64-q5qwg 1/1 Running 0 5m28s 172.17.82.100 master kube-system kube-proxy-hf59b 1/1 Running 0 4m58s 172.17.82.110 slave1 kube-system kube-proxy-r7pz6 1/1 Running 0 7m56s 172.17.82.100 master kube-system kube-scheduler-master 1/1 Running 0 8m5s 172.17.82.100 master gtan@master:~$
gtan@master:~$ curl -IL http://172.17.82.100:30131 curl: (7) Failed to connect to 172.17.82.100 port 30131: Connection refused
where "172.17.82.100" is the master node ip address.
gtan@master:~$ kubectl get services -o wide -A NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR default kubernetes ClusterIP 10.96.0.1 443/TCP 15m default mynginx1 NodePort 10.102.106.240 80:30131/TCP 10m app=mynginx1 kube-system kube-dns ClusterIP 10.96.0.10 53/UDP,53/TCP,9153/TCP 15m k8s-app=kube-dns