nginx in kubernetes
Prerequisite: Set up k8s cluster
kubectl apply -f nginx-deployment.yaml
kubectl get deployments
kubectl get pods -o wide
kubectl get replicasets -w
Try to remove one of the nginx docker containers, and like magic, k8s will automatically create a new one!
kubectl apply -f nginx-service.yaml
kubectl get services
kubectl describe service nginx-service
You should be able to curl it now
kubectl delete -f nginx-deployment.yaml
kubectl delete -f nginx-service.yaml
kubectl apply -f namespace-example.yaml
kubectl get namespaces
kubectl apply -f pod-quota.yaml --namespace=namespace-example
kubectl apply -f nginx-deployment.yaml --namespace=namespace-example
kubectl get deployment nginx-deployment --namespace=namespace-example
kubectl get deployment nginx-deployment --namespace=namespace-example --output=yaml
Only 2 replicas are allowed
kubectl delete -f namespace-example.yaml