DigitalOcean Kubernetes (DOKS) is a managed Kubernetes service that lets you deploy Kubernetes clusters without the complexities of handling the control plane and containerized infrastructure. Clusters are compatible with standard Kubernetes toolchains and integrate natively with DigitalOcean Load Balancers and block storage volumes.
Digitalocean kubectl is basically the official command-line tool for connecting to and interacting with the cluster in Kubernetes.
Here at Ibmi Media, we shall look into Digitalocean kubectl.
DigitalOcean Kubernetes clusters are typically managed locally or remotely via a management server.
To connect, we must first create a cluster and then add an authentication token or certificate to the kubectl configuration file.
i. Firstly, use the following command to configure authentication from the command line, substituting the name of our cluster:
$ doctl kubernetes cluster kubeconfig save use_our_cluster_name
ii. This downloads the cluster's kubeconfig, merges it with any existing configuration from ~/.kube/config, and takes care of the authentication token or certificate automatically.
When using recent versions of Kubernetes and doctl, this automatically generates a revocable OAuth token, and when using legacy versions, it automatically renews a certificate.
We can also manually download a cluster configuration file from the control panel:
We can use kubectl to create, manage, and deploy clusters once the cluster configuration file is in place. We can also add DigitalOcean Load Balancers and block storage volumes to our cluster from this point.
This article covers how to use Digitalocean kubectl. In fact, Kubectl is a command-line tool designed to manage Kubernetes objects and clusters. It provides a command-line interface for performing common operations like creating and scaling Deployments, switching contexts, and accessing a shell in a running container.
To test that kubectl can authenticate with and access your Kubernetes cluster, use cluster-info:
$ kubectl cluster-info
To view your kubectl configuration, use the view subcommand:
$ kubectl config view
To fetch a list of clusters defined in your kubeconfig, use get-clusters:
$ kubectl config get-clusters
The general syntax for most kubectl management commands is:
$ kubectl command type name flags
Where: