For using the bash shell of POD
kubectl exec -it <podname> -- /bin/bashExample kubectl exec -it POD1 -- /bin/bash -- In case of POD has multi container pod then we specify the container namekubectl exec -it <podname> --container <containername> -- /bin/bash example: kubectl exec -it POD1 --container CONTAINER1 -- /bin/bash
Check Logs of POD
kubectl logs <podname>Example: kubectl logs POD1
To access the application of POD in local system
kubectl port-forward <PODNAME> LOCALPORT:CONTAINERPORTExample:kubectl port-forward POD1 8080:8080 Run in background kubectl port-forward POD1 8080:8080 &
Monitor the Kubectl event run behind the commands enable this command:
kubectl get events --watch &-- this command run in background and give output when you execute any kubenete commands
Create a manifest file with kubectl command
kubectl run hello-world --image=nginx cop --dry-run=client -o yaml --port=8080