- Types of machines in a k8s cluster:
- control plane node(s) (or just called control plane),
- worker nodes (or just called nodes).
- control plane has
kube-apiserver
: k8s API frontend,etcd
: key-value store for cluster data,kube-scheduler
: assigns resources to nodes based on current constraints,kube-controller-manager
: several control loops in one process,cloud-controller-manager
: several cloud-specific control loops in one process.
- worker nodes have
kubelet
: manages containers deployed to that node,kube-proxy
: manages network rules on nodes,- Container Runtime: what runs the containers. Any implementation of the K8s Container Runtime Interface (e.g., CRI provided for Docker is the most common).
- Abstraction of Workload:
- Pod: smallest deployable unit — holds one or more containers and runs it in a shared context
- Workload resources:
Used to manage groups of Pods
- Deployment: for managing stateless Pods
- ReplicaSet: abstraction to manage a number of identical Pods. Typically not used directly.
- StatefulSet: for managing stateful Pods (e.g., DBs)
- Deployment: for managing stateless Pods
- Abstraction of Storage
- Volume: many types of volumes provided by plugins (local, network/distributed FS, cloud)
- Abstraction of Networking
- Abstraction of Configuration
- ConfigMaps
- Secrets
- Note on environment variables: The Twelve-Factor App - Config
-
eval "$( kubectl completion bash )"
-
eval "$( minikube completion bash )"
-
minikube start
-
kubectl get nodes
-
minikube status
-
kubectl version
-
minikube delete
-
kubectl get nodes
-
kubectl get pod
-
kubectl get pod -o wide
-
kubectl get services
-
kubectl create deployment nginx-deploy --image=nginx
-
kubectl get deployment
-
kubectl get replicaset
-
kubectl edit deployment nginx-deploy
-
kubectl logs [pod]
-
kubectl exec -it {pod} -- bin/bash
-
kubectl delete deployment nginx-deploy
- taken from https://gitlab.com/nanuchi/youtube-tutorial-series/-/tree/master/demo-kubernetes-components
kubectl apply -f mongodb/mongo-secret.yaml
kubectl apply -f mongodb/mongo.yaml
kubectl apply -f mongodb/mongo-configmap.yaml
kubectl apply -f mongodb/mongo-express.yaml
kubectl get pod
kubectl get pod --watch
kubectl get pod -o wide
kubectl get service
kubectl get secret
kubectl get all | grep mongodb
kubectl describe pod mongodb-deployment-xxxxxx
kubectl describe service mongodb-service
kubectl logs mongo-express-xxxxxx
minikube service mongo-express-service
- Package manager: https://helm.sh/
- Lightweight K8s: https://k3s.io/
- https://prometheus.io/docs/introduction/overview/
- Lens IDE https://k8slens.dev/