15-20 Tasks. 17 for me. 2 hours. ~ 3 clusters. Context change commands are given. ControlPlane + 2 Nodes.
Add to .bashrc
alias k=kubectl # will already be pre-configured
export do="--dry-run=client -o yaml" # k create deploy nginx --image=nginx $do //useful
export now="--force --grace-period 0" # k delete pod x $now //not very
k get nodes -o jsonpath={".items[*].spec.podCIDR"}
k get nodes -o json | jq ".items[].spec.podCIDR"
k get nodes -o jsonpath={".items[*].status.nodeInfo.osImage"}
k get nodes -o json | jq ".items[].status.nodeInfo.osImage"
kubectl run nginx --image=nginx
kubectl run nginx --image=nginx --labels=env=prod --dry-run=client -o yaml > nginx_pod.yaml
kubectl create deploy --image=nginx nginx
kubectl create deploy --image=nginx nginx --dry-run=client -o yaml > nginx-deployment.yaml
To create a daemonset, use Create deployment template file and change the kind and remove replicas & strategy.
kubectl apply -f https://k8s.io/examples/pods/storage/pv-volume.yaml
kubectl expose pod valid-pod --port=444 --name=frontend
kubectl create configmap app-config --from-literal=env=dev
kubectl create secret generic app-secret --from-literal=pass=123
-
Controlplane apt update apt upgrade kubeadm=1.26.0-00 kubeadm upgrade plan kubeadm upgrade apply v1.26.0
-
Worker Nodes apt update apt upgrade kubeadm=1.26.0-00 kubeadm upgrade node
-
Kubelet/Kubectl(all nodes) apt-get install -y kubelet=1.26.0-00 kubectl=1.26.0-00 systemctl daemon-reload systemctl restart kubelet
- snapshot
- restore