Arquitectura de kubernetes
- kubelet
- control plane
Pod
kubectl run nginx-pod \
--image=nginx:1.27 \
--port=80 \
--restart=Never
kubectl delete pod nginx-pod
Replicaset
- utilizado para garantizar la disponibilidad del numero definido de pods identicos
- Selector: identificar los pods
- Replica count:
- Pod template
Deployment
kubectl create deployment nginx-deployment \
--image=nginx:1.27 \
--replicas=2
kubectl delete deployment nginx-deployment
Service
kubectl expose deployment nginx-deployment \
--name=nginx-service \
--type=ClusterIP \
--port=80 \
--target-port=80
kubectl delete service nginx-service
Namespace
kubectl create namespace dev
kubectl get namespace
kubectl config set-context --current --namespace=dev
Logs y troubleshooting
kubectl logs <pod>
kubectl logs -f <pod>
kubectl logs --tail=100 <pod>
kubectl exec -it <pod> -- /bin/bash
kubectl exec -it <pod> -- /bin/sh
configmap
kubectl create configmap app-config \
--from-literal=ENV=prod \
--from-literal=LOG_LEVEL=info
ENV=prod
LOG_LEVEL=info
kubectl create configmap app-config \
--from-file=./config.properties
secrets
- ingress
- cronjob