kubernetes Getting started with kubernetes Configure kubectl

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

A Kubernetes cluster is controlled using the kubectl command. The method of configuring kubectl depends on where Kubernetes is installed.

Google Cloud (Container Engine)

To install kubectl using the Google Cloud SDK:

gcloud components install kubectl

To configure kubectl to control an existing Kubernetes cluster in Container Engine:

gcloud container clusters get-credentials $CLUSTER_NAME

Minikube

When using minikube, the kubectl binary needs to be manually downloaded and placed in the path.

# Version of Kubernetes.
K8S_VERSION=$(curl -sS https://storage.googleapis.com/kubernetes-release/release/stable.txt)
# Operating System. Can be one of {linux, darwin}
GOOS=linux
# Architecture. Can be one of {386, amd64, arm64, ppc641e}
GOARCH=amd64

# Download and place in path.
curl -Lo kubectl http://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/${GOOS}/${GOARCH}/kubectl
chmod +x kubectl
sudo mv kubectl /usr/local/bin/

The minikube binary automatically configures kubectl when starting a cluster.

minikube start
# kubectl is now ready to use!


Got any kubernetes Question?