Pustaka Taratsa

Baca teks (EPUB): Kubectl: pods

1 bagian

Teks ini diambil langsung dari berkas EPUB; tata letak dan gambar tidak disertakan. Untuk tampilan lengkap, silakan merujuk pada dokumen asli.

Daftar isi
  1. Kubectl: pods
  2. Create Deployment
  3. Create Service
  4. Enable addons
  5. Clear
  6. Test nginx
  7. Test Hello World
  8. Test Hello Apps
  9. Create an Ingress Resource
  10. 2nd Deployment
  11. Etc
  12. Referensi

Kubectl: pods

Sumber: https://onnocenter.or.id/wiki/index.php/Kubectl:_pods

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
minikube service list
minikube ip
minikube service my-loadbalancer-service-name --url
minikube service nginx --url

Test Hello World

kubectl apply -f https://k8s.io/examples/service/access/hello-application.yaml
kubectl get deployments hello-world
kubectl describe deployments hello-world
kubectl get replicasets
kubectl describe replicasets
kubectl expose deployment hello-world --type=NodePort --name=example-service
kubectl get pods --selector="run=load-balancer-example" --output=wide
kubectl cluster-info
curl http://<public-node-ip>:<node-port>
minikube service list

Test Hello Apps

kubectl create deployment web --image=gcr.io/google-samples/hello-app:1.0
kubectl expose deployment web --type=NodePort --port=8080
kubectl get service web
minikube service list
minikube service web --url
curl <URL>

Create an Ingress Resource

kubectl apply -f https://k8s.io/examples/service/networking/example-ingress.yaml
kubectl get ingress
minikube ip
edit sudo vi /etc/hosts
192.168.99.100  hello-world.info
curl http://hello-world.info

2nd Deployment

kubectl create deployment web2 --image=gcr.io/google-samples/hello-app:2.0

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