Playlist :
References:
- Minikube
- Minikube v1.14.0
- Minikube Installation
- Install Kubectl
- Kubernetes Pod Template
- Source Belajar Kubernetes
kubectl create -f filepod.yaml
kubectl get pod
kubectl get pod -o wide
kubectl describe pod podname
kubectl port-forward podname AccessPort:PodPort
kubectl delete pod podname
kubectl delete pod podname1 podname2 podname3
kubectl delete pod -l environment=development
kubectl delete pod --all --namespace namespacename
kubectl delete pod --all
- Label values cannot contain space characters
kubectl get pod --show-labels
kubectl label pod podname key=value
kubectl label pod podname key=value --overwrite
kubectl get pod -l key
kubectl get pod -l key-value
kubectl get pod -l '!key'
kubectl get pod -l key!=value
kubectl get pod -l 'key in (value1,value2)'
kubectl get pod -l 'key notin (value1,value2)'
kubectl get pod key1,key2=value
kubectl get pod key1=value,key2=value
- Almost like label, but cannot be filtered
- Used to store lots of information
- Can store information up to 256 KB
kubectl annotate pod podname key=value
kubectl annotate pod podname key=value --overwrite
When to use namespace?
- When the resources in kubernetes are too many
- When we need to separate multi-tenant resources, team or environment
- Resources can have same names but within different namespaces
kubectl get namespaces
kubectl get namespace
kubectl get ns
kubectl get pod --namespace namespacename
kubectl get pod -n namespacename
kubectl create -f pod.yaml --namespace namespacename
kubectl delete namespace namespacename
- Probe here mainly focusing on liveness, readiness, and startup probe in kubernetes
- kubelet uses liveness probe to check when to restart the pods for example, when the liveness probe on a pod does not respond, it will then restart the pod automatically
- kubelet uses readiness probe to check whether a pod is ready to accept incoming traffic
- kubelet uses startup probe to check whether a pod has run or not, if not yet, then kubelet will not check for liveness and readiness
- startup probe is suitable for pods having long startup time
- Probe checking mechamism: HTTP Get, TCP Socket, Command Exec
- initialDelaySeconds: seconds needed to wait for the initial container start, default 0
- periodSeconds: seconds needed to wait between check intervals, default 10
- timeoutSeconds: seconds needed to wait for a container to respond before flagging it as a timeout, default 1
- successThreshold: number of retries to be considered as a successful retry, default 1
- failureThreshold: number of retries to be considered as a failed retry, default 3
kubectl describe pod podname