Everything below the deployment is managed automatically by K8S
Setup Lab
Install Minikub K8S Cluster on Mac m1, follow
// To Start Minikube
$ minikube start --driver=docker --alsologtostderr
Commands
// See status of Minikube K8S cluster
$ minikube status
// To launch Minikube K8S Dashboard
$ minikube dashboard
// To see list of pod running on K8S Minikube Env
$ kubectl get nodes
// See version of K8S:
$ kubectl version
// See cluster service running
$ kubectl get services
/// To create a K8S Resource Component
// help on the command to understand its syntax
$ kubectl create -h
*// We don't create pod, we create an pod abstraction object named: deployment
// Create an NGINX Pod
$ kubectl create deployment nginx-depl --image=nginx
*// name and image are the 2 min param do create a deployment blueprint
// see the pod depoyed
$ kubectl get deployment
//see pod
$ kubectl get pod
*// in name nginx-depl-c88549479-nmvjh, c88.. is the replica hash and nm.. is the pod id instance specific ref
// To see replicaset
*// between deployment and pod, there is replicaset concept
$ kubectl get replicaset
*// nginx-depl-c88549479, After pod name, we have an random c88, that is the hash of the replicaset
// Edit the parameter of a component deployment
$ kubectl edit deployment nginx-depl
/// Debugging activities:
// Logs of a running pod
$ kubectl logs "full pod name: nginx-depl-ReplicaHash-PodID"
// TO have nice info on status pod more in details:
$ kubectl describe pod "PodFullName"
// To go on terminal of the app running on the pod (we are inside the container as root user)
// usefull to enter the container and execuse some command for debug
$ kubectl exec -it "FUll Pod Name" -- bin/bash
// to Exit
$ exit
// To delete a deployement (and kill running pod)
$ kubectl delete deployment "deployemnt name"
*//!! All crud operation happen at deployement level, all the rest below is automatically managed by K8S cluster
/// Create Config file for a component
*// for more complex setup, we are not going to specify all the parameters and options via CLI: kubectl create deploymenet name image opeiotn1, option2...
// we will use config file for the component to deploy
$ kubectl apply -f config-file.yaml