This repository aims to help kubernetes beginners to learn the basics with very simple examples obtained from many sources. I have created a Makefile
to simplify the example's execution.
- Linux or MacOS
- docker
- kubectl
- curl
- make
- kind (kind.io)
Install kind and execute the following command to start a kubernetes cluster:
make start
make list
make 1-pods
kubectl get pods
kubectl delete pod hello
kubectl get pods
make 2-services
kubectl get pods,svc
curl localhost:31000
kubectl delete pod hello
curl localhost:31000
kubectl delete svc hello
make 3-deployments
kubectl get pods,svc
curl localhost:31000
kubectl delete pods -l app=hello
curl localhost:31000
kubectl delete svc hello
kubectl delete deploy hello
make 4-replicas
kubectl get pods,svc
curl localhost:31000
kubectl delete svc hello
kubectl delete deploy hello
make 5-updates-recreate
kubectl get pods,svc
curl localhost:31000
kubectl set image deployment/hello hello-from=pbitty/hello-from:error
kubectl get pods
kubectl get replicasets
curl localhost:31000
kubectl rollout status deployment/hello
kubectl rollout history deploy/hello
kubectl rollout history deploy/hello --revision=2
kubectl rollout history deploy/hello --revision=1
kubectl rollout undo deployment/hello --to-revision 1
kubectl rollout status deployment/hello
curl localhost:31000
kubectl delete svc hello
kubectl delete deploy hello
make 5-updates-rolling
kubectl get pods,svc
curl localhost:31000
kubectl set image deployment/hello hello-from=pbitty/hello-from:error
kubectl get pods
kubectl get replicasets
curl localhost:31000
kubectl rollout status deployment/hello
kubectl rollout history deploy/hello
kubectl rollout history deploy/hello --revision=2
kubectl rollout history deploy/hello --revision=1
kubectl rollout undo deployment/hello --to-revision 1
kubectl rollout status deployment/hello
curl localhost:31000
kubectl delete svc hello
kubectl delete deploy hello
The following command deletes the cluster:
make stop