kubectl
The Kubernetes command-line tool allows you to run commands against Kubernetes clusters.
Prerequisites
- p6m CLI - For SSO and cluster configuration
Installation
Official installation guide: kubernetes.io/docs/tasks/tools
- Windows
- macOS
- Linux
# Using winget
winget install Kubernetes.kubectl
# Using Chocolatey
choco install kubernetes-cli
# Using Homebrew
brew install kubectl
# Using snap
sudo snap install kubectl --classic
# Using apt (Ubuntu/Debian)
sudo apt-get update && sudo apt-get install -y kubectl
Verify Installation
kubectl version --client
Quick Reference
For day-to-day usage, see the official kubectl Cheat Sheet.
Essential Commands
# View cluster info
kubectl cluster-info
# List resources
kubectl get pods
kubectl get pods -A # all namespaces
# Inspect resources
kubectl describe pod <pod-name>
kubectl logs <pod-name>
# Interactive access
kubectl exec -it <pod-name> -- /bin/bash
Related
- kubectl Cheat Sheet - Quick reference (recommended)
- Official kubectl Documentation - Complete reference
- Configuration - Configure cluster access