Skip to content

Kubectl Commands

Anvesh Muppeda edited this page Mar 31, 2023 · 1 revision

Welcome to Kubernetes commands

To login to a pod Syntax:

kubectl exec <nginx-pod> -n <namespace> -it -- /bin/bash

Example:

kubectl exec nginx-7f456874f4-vdmxm -n anvesh -it -- /bin/bash

To forward the traffic
Syntax:

k port-forward service/<service-name> -n <namespace> <ourexposingport>:<podport> 

Example:

k port-forward service/ngnix-service -n anvesh 8080:80