Kubernetes CLI: kubectl
kubectl is the command line interface for Kubernetes.
Basic kubectl commands
| Command | Description |
|---|---|
kubectl get pods | List all pods |
kubectl cluster-info | Display cluster information |
kubectl get all | List all resources: Pods, deployments, services, etc. |
kubectl run [container-name] --image=[image-name] | Create a deployment for a pod |
kubectl port-forward [pod-name] [port-number] | Forward a port to a pod to allow external access |
kubectl create [resource] | Create a resource |
kubectl apply [resource] | Create or update resource |
Useful Aliases for kubectl
A common practice for kubectl is to alias it to k for convenience.
To alias kubectl to k in PowerShell:
Set-Alias -Name k -Value kubectlTo alias kubectl to k in bash:
alias k="kubectl"You can test the alias by running k version.
Broader Topics Related to Kubernetes CLI: kubectl

Kubernetes (k8s)
A system to conduct an orchestra of containers

Command-line Interfaces (CLI)
Programs that take commands through terminals and shells