kubectl cluster-info - To show information about the Kubernetes cluster. It's a command line tool installed with K8s that allows us to interact with a cluster
kubectl run - Create a pod from the command line. Specifying a name, the image and the port where the container responds.
kubectl run frontend --image=makader/myapp:frontendmvc-v1 --port 80 --restart=Never
restart indicates that if the pod fails or dies, it will never be recreated.
kubectl get pods - to see the created pods and their status
kubectl describe - to analyze the created pod in depth
- The image contains, a status label for the POD and the container.
- The POD states are: the Pending value, during which the containers in it are loaded, the Failed state, if there are errors creating the containers; otherwise the Running state, all containers are created and at least one is starting, restarting, or running.
kubectl describe pod frontendmvc
kubectl describe service myapp-rc-service
kubectl delete
kubectl delete pod frontendmvc
kubectl delete service myapp-rc-service
Create a pod from a configuration file
kubectl create -f forntendmvc_pod.yml
kubectl create -f forntendmvc_rc.yml
kubectl proxy - To access the application locally, Enable the Kubernetes proxy with the cmd that starts a proxy server.
Command to show all Kubernetes secrets "kubectl -n kubernetes-dashboard get secret"
Command to show the specified secret details "kubectl -n kube-system describe secret kubernetes-dashboard-token-n4bqw"
Command to expose the replication controller
kubectl expose rc myapp-rc --name=myapp-rc-service --type=NodePort
No comments:
Post a Comment