kubectl api-resources code example

Example 1: kubectl get pods

# Get pods in default namespace
kubectl get pods

#Get Pods in my-namespace
kubectl get pods -n my-namespace

#Get Pods in all namespaces
kubectl get pods --all-namespaces

Example 2: kubernetes get services

# Get pods in default namespace
kubectl get services

#Get Pods in my-namespace
kubectl get services -n my-namespace

#Get Pods in all namespaces
kubectl get services --all-namespaces

Example 3: kubectl

curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl

Example 4: kubectl

curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/windows/amd64/kubectl.exe