Professional Documents
Culture Documents
Lab6-Services
Lab6-Services
-------------
We will create the sample deployment and expose it using nodePort service. Finally
we will test it!
***********************************************************************************
****************
c) Deploying Applications:
--------------------------
kubectl apply -f nginx-deploy.yaml
kubectl apply -f nginx-svc-np.yaml
***********************************************************************************
****************
Deployment:
-----------
kubectl create deployment [DEPLOYMENT-NAME] --image=[CONTAINER-IMAGE]--
replicas=[REPLICA-COUNT]
Service:
--------
kubectl expose deployment [DEPLOYMENT-NAME] --type=NodePort --name=[SERVICE-NAME]
--port=[PORT-NUMBER]
***********************************************************************************
****************
Second option:
c. Now, get the NodePort service number on which this service is exposed on:
-----------------------------------------------------------------------------
kubectl get svc
d. Next, get the external IP address of the worker node on which this Pod is
running
-----------------------------------------------------------------------------------
--
kubectl get pods -o wide
e. Then, you can open the any browser or execute curl command as mentioned below.
The syntax is the external IP of the worker node followed by nodePort number
-----------------------------------------------------------------------------
***********************************************************************************
****************
4. Cleanup
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kubectl delete deploy [NAME]
kubectl delete svc [NAME]
***********************************************************************************
****************