Publishing the Application

5/29/2019

I followed the instructions found here...

https://schoolofdevops.github.io/ultimate-kubernetes-bootcamp/quickdive/

As you can see, "NodePort" type do not have external-IP like wordpress. Therefore I can not connect.

#  /usr/local/bin/kubectl --kubeconfig="padhaku2.yaml" get service
NAME         TYPE           CLUSTER-IP      EXTERNAL-IP    PORT(S)        AGE
kubernetes   ClusterIP      10.245.0.1      <none>         443/TCP        38m
vote         NodePort       10.245.33.151   <none>         81:31876/TCP   6m20s
wordpress    LoadBalancer   10.245.170.65   139.59.49.69   80:31820/TCP   21m

How do I publish the app using external IP?

-- shantanuo
digital-ocean
kubernetes

2 Answers

5/29/2019

you can access the application using nodeport.

try http://NODEIP:NODEPORT

in your case, http://NODEIP:31876

follow the steps to update the service type

kubectl delete svc vote
kubectl expose deployment vote --type=LoadBalancer --port 80

you might need to deploy rest of the voting services

kubectl  run redis  --image=redis:alpine

kubectl expose deployment redis --port 6379


kubectl  run worker --image=schoolofdevops/worker

kubectl  run db --image=postgres:9.4

kubectl expose deployment db --port 5432

kubectl run result --image=schoolofdevops/vote-result

kubectl expose deployment result --type=NodePort --port 80
-- P Ekambaram
Source: StackOverflow

5/29/2019

If your service type is NodePort, you can connect to your service using the address <protocol>://<Node_ip>:<NodePort>, where

**protocol** may be **http** or **https**
**Node_ip** is the IP of the Node where your application is running
**NodePort** is the value of the **NodePort** field used in your service manifest file
-- Shudipta Sharma
Source: StackOverflow