Sunday, 20 September 2020

Getting Started with kubernetes

 Hello guys, Hope you have learned how to push the images to the Docker hub. Now it's time to pull using Kubernetes and run it locally. 

1. Start minikube. 

>minikube start 

2.   Open the dashboard. 

minikube dashboard 

This Script automatically starts the dashboard in the random port.



3 . Create Deployment. 

>kubectl create deployment greet-node --image=syedghouse14/greet-user-repo:initial 
If you execute the above Command then the K8s start pulling the images from the docker hub and 
deploy into the k8s. 

In order to access this deployment, it should be of showing as green.

4. Get Deployments 

>kubectl get deployments 

5. Get Pods. 

kubectl get pods 

6. Get Events 

kubectl get events 

7.Show Config  

>kubectl config view 

8.To Expose 

kubectl expose deployment greet-node --type=LoadBalancer --port=8080 

You will get the following output  

C:\Users\Syed>minikube service greet-node 
|-----------|------------|-------------|-------------------------| 
| NAMESPACE |    NAME    | TARGET PORT |           URL           | 
|-----------|------------|-------------|-------------------------| 
| default   | greet-node |        8080 | http://172.17.0.2:32722 | 
|-----------|------------|-------------|-------------------------| 
* Starting tunnel for service greet-node. 
|-----------|------------|-------------|------------------------| 
| NAMESPACE |    NAME    | TARGET PORT |          URL           | 
|-----------|------------|-------------|------------------------| 
| default   | greet-node |             | http://127.0.0.1:51275 | 
|-----------|------------|-------------|------------------------| 
* Opening service default/greet-node in default browser... 
! Because you are using a Docker driver on windows, the terminal needs to be open to run it. 
 
Access it using http://127.0.0.1:51275/ 
 

We can Check the detailed way of all the components in the upcoming blogs.

No comments:
Write comments