K8s practice
kubectl get all
kubectl cluster-info
kubectl get nodes
kubectl get nodes -o wide
kubectl describe node ${node_name}
kubectl get pods --all-namespaces
kubectl config view
kubectl get pods --show-labels
kubectl describe pods
kubectl logs ${POD_NAME}
kubectl delete all --all -n ${namespace}
kubectl exec -it ${podname} sh
kubectl apply -f ./namespaces/00-namespace-testing.yaml
kubectl get ns
kubectl -n testing apply -f ./services/01-wordpress-service-np.yaml
kubectl -n testing get svc
kubectl -n testing delete svc ${SVC_NAME}
kubectl -n testing apply -f ./services/03-wordpress-service-lb.yaml
kubectl -n testing apply -f ./services/05-hello-app-service-lb.yaml
kubectl -n testing get svc
kubectl -n testing apply -f ./controllers/02-wordpress-rc.yaml
kubectl -n testing get pods
kubectl -n testing delete pod ${POD_NAME}
kubectl -n testing get deployments
kubectl -n testing get rs
kubectl -n testing apply -f ./controllers/04-hello-app-deployment.yaml
kubectl -n testing get pods
kubectl -n testing describe deployment deployment.v1.apps/hello-deployment
kubectl -n testing scale --replicas=5 deployment.v1.apps/hello-deployment
kubectl -n testing delete pod ${POD_NAME}
kubectl -n testing autoscale deployment.v2.apps/hello-deployment --min=2 --max=5 --cpu-percent=80
- NodePort: create a port in every node, you need to use the ip of the node and the port.
- Services: Refers to a set of pods, send traffic based in a policy (labels).
- Liveness Probe: It's to let Kubernetes know if your pod is alive.
- Readiness Probe: It's to let Kubernetes know if your pod is ready to receive traffic.
- HPA: Horizontal Pod Autoscaler.