Difference between revisions of "Kubectl: pods"

From OnnoWiki
Jump to navigation Jump to search
Line 18: Line 18:
 
  kubectl get services
 
  kubectl get services
 
  minikube service hello-node
 
  minikube service hello-node
 +
 +
 +
kubectl cluster-info
  
 
==Enable addons==
 
==Enable addons==

Revision as of 12:18, 17 October 2020

Sumber: https://kubernetes.io/docs/tutorials/hello-minikube/


Create Deployment

kubectl create deployment hello-node --image=k8s.gcr.io/echoserver:1.4
kubectl create deployment nginx --image=nginx
kubectl get deployments
kubectl get pods
kubectl get events
kubectl config view

Create Service

kubectl expose deployment hello-node --type=LoadBalancer --port=8080
kubectl expose deployment nginx --type=LoadBalancer --port=8080
kubectl expose deployment hello-world --type=NodePort --name=example-service
kubectl get services
minikube service hello-node


kubectl cluster-info

Enable addons

minikube addons list
minikube addons enable metrics-server
kubectl get pod,svc -n kube-system
minikube dashboard


minikube addons disable metrics-server

Clear

kubectl delete -n default pod hello-world
kubectl delete service hello-node
kubectl delete deployment hello-node
minikube stop
minikube delete

Test nginx

kubectl -s http://localhost:8080 run nginx --image=nginx  --replicas=3 --port=80
kubectl get rc
kubectl get services
kubectl get deployments
kubectl get pods
kubectl expose deployment nginx --port=80 --type=LoadBalancer
kubectl get services
kubectl describe svc nginx

Etc

kubectl get pods


kubectl describe pod hello-minikube-6ddfcc9757-mljlz
kubectl describe pod balanced-5744b548b4-k9mch


kubectl -s http://localhost:8080 run nginx --image=nginx  --replicas=3 --port=80
kubectl run nginx --image=nginx  --replicas=3 --port=80


Referensi