Kubernetes 101 also uses minikube so here’s a mixin of both.
Minikube
Installed with pacman
sudo pacman -S minikube kubectlCreate a minikube cluster
minikube startOpen minikube dashboard
minikube dashboardCreate a Deployment
A Deployment is the way to manage Pods
# Run a test container image that includes a webserver
kubectl create deployment hello-node --image=registry.k8s.io/e2e-test-images/agnhost:2.39 -- /agnhost netexec --http-port=8080View the deployment
kubectl get deploymentsView the pod
kubectl get podsCheck up cluster events. Those show the list of steps taken by the deployment.
kubectl get eventsView the kubectl configuration
kubectl config viewView application lgos
kubectl logs hello-node-5f76cf6ccf-br9b5Create a Service
By default a pod is not accessible from outside. A cluster is a closed encapsulated network, like docker. The Pod created in the last steps must be exposed as a k8s service.
# Create the service
kubectl expose deployment hello-node --type=LoadBalancer --port=8080
# View the service
kubectl get services
# Open the service on the browser
minikube service hello-nodeDefinitions
Pods
A Kubernetes Pod is a group of one or more Containers, tied together for the purposes of administration and networking. There are two types: Pods that run a single container, Pods that run multiple containers tighly coupled together.
NOTE
Restarting a container in a Pod should not be confused with restarting a Pod. A Pod is not a process, but an environment for running container(s). A Pod persists until it is deleted.
Deployment
It’s a declarative update of a set of Pods or ReplicaSets. You declare the desired state in a deployment file and a Controller takes care of making that state happen.
Cleanup
kubectl delete service hello-node
kubectl delete deployment hello-node
# Optional
minikube deleteSources
https://kubernetes.io/docs/tutorials/hello-minikube/ https://minikube.sigs.k8s.io/docs/tutorials/kubernetes_101