Site icon i2tutorials

Kubernetes – Kubectl

Kubernetes – Kubectl

 

It is used to communicate and manage pods in Kubernetes clusters through the Kubectl command line utility.

To interact with Kubernetes clusters, one needs to set kubectl to local.

Setting Kubectl

Using curl, download the executable to the local workstation.

On Linux

$ curl -O https://storage.googleapis.com/kubernetesrelease/
release/v1.5.2/bin/linux/amd64/kubectl

Once the download is done, move the binaries to the system’s path.

$ chmod +x kubectl
$ mv kubectl /usr/local/bin/kubectl

Configuring Kubectl

Here’s how to configure it.

$ kubectl config set-cluster default-cluster --server = https://${MASTER-HOST} --
certificate-authority = ${CA-CERT}
$ kubectl config set-credentials default-admin --certificateauthority = ${
CA-CERT} --client-key = ${ADMIN-KEY} --clientcertificate = ${
ADMIN-CERT}
$ kubectl config set-context default-system --cluster = default-cluster --
user = default-admin
$ kubectl config use-context default-system

Verifying the Setup

Check if the Kubernetes client is set up right before using kubectl.

$ kubectl get nodes

 

Exit mobile version