Kubernetes is a platform for orchestrating containerised applications. Learn how to get started with DigitalOcean’s Managed Kubernetes service in this article.
Why Use Managed Kubernetes?
Both these projects focus on providing a lightweight solution that’s easy to get to grips with. Even so, hosting your own Kubernetes installation can be time-consuming and tricky to maintain. All the major public cloud providers have now developed fully-managed Kubernetes offerings which let you deploy apps quickly with minimal setup.
DigitalOcean’s Managed Kubernetes service lets you create a Kubernetes cluster in only a few minutes. It supports the full Kubernetes API, node auto-scaling, and automatic Kubernetes version upgrades.
DigitalOcean provides the Kubernetes control plane for free – you only pay for the nodes you add to the cluster. Nodes on DigitalOcean use the platform’s existing cloud compute instances, termed “droplets.” These are available in a range of sizes and start at $10/mo for a single vCPU with 2GB of RAM.
A word of warning before continuing: following the remainder of this guide will cause costs to accrue against your DigitalOcean account. We advise you use small, low-cost nodes when working with a Kubernetes cluster created for experimental purposes.
Creating Your Cluster
Begin by logging into your DigitalOcean account. Click the green “Create” button at the top right of the screen. Select “Kubernetes” from the menu that appears.
Begin by choosing the Kubernetes version to use. At the time of writing, the 1.17, 1.18 and 1.19 major releases are available. It’s advisable you use the newest release (1.19) unless you have a specific reason not to.
Next, select a DigitalOcean datacentre to contain your cluster’s resources. It’s a good idea to use the datacentre that’s geographically closest to where you and your users are situated.
Choosing Cluster Capacity
Scroll down to the “Choose cluster capacity” section. Here you can define the nodes which will be available to the cluster. Your cluster’s workloads will execute on these nodes. The nodes will be orchestrated automatically by the Kubernetes control plane provided by DigitalOcean.
Nodes are sorted into Node Pools. This is a Kubernetes term for a group of one or more Nodes, each with the same hardware resources. For our purposes, we only need a single Node Pool to get started.
The “Machine Type” dropdown lets you choose which kind of DigitalOcean droplet to use. It’s worth reviewing the droplet pricing table if you’re unsure of the differences between each type. We’ll be sticking with the “Basic nodes” which give a good balance between compute performance and available memory.
Select the droplet variant to use from the “Node Plan” dropdown. To save costs, we’re using the smallest option available – 1 vCPU and 1GB RAM, priced at $10/month per node. DigitalOcean labels this as a “development plan” as the available resources are unlikely to be sufficient for long-term production use.
Finally, specify how many nodes to add to the cluster. The default selection is 3 but you can reduce this down to 1 for development purposes. Be aware that your services will be unavailable during Kubernetes upgrades if you opt to use only a single node. Multiple nodes increase redundancy, support horizontal scaling and reduce downtime during updates.
Once you’re done adding your nodes, scroll down the page and give your cluster a name. Click the “Create cluster” button to begin the provisioning process. This will take up to five minutes to complete.
Getting Started With Your Cluster
While you wait, you can click through the “Getting Started” guide displayed at the top of the page. This will walk you through downloading
kubectl, the official Kubernetes command-line client, and
doctl, DigitalOcean’s own client.
The next step allows you to download your cluster’s Kubernetes configuration file. This can be used with
kubectl to connect to your cluster – once downloaded, pass its path as the value to the
kubectl --kubeconfig=kubeconfig-path.yaml get nodes
The above command will list the details of all the nodes in your cluster.
When using this method, be aware that the authentication certificate expires after a week. You’ll need to re-download it when the timer expires. An alternative approach uses
doctl to fetch the configuration file and configure automated certificate management – use the command shown under “Automated certificate management” to set this up.
The last stage allows you to quickly install “1-Click Apps” from the DigitalOcean Marketplace. These are preconfigured deployments of commonly-used services, such as NGINX Ingress Controller and Linkerd. Click “Install” next to any of the apps to add to your cluster. The process may take several minutes to complete.
Managing Your Cluster
You can see your cluster’s Node Pools and their Nodes by clicking the “Nodes” tab at the top of the screen. Click a Node Pool to view the Nodes within.
You can add a new Node Pool by clicking the “Add Node Pool” button in the top right. To edit an existing Node Pool, click the three-dots icon to the right of the table and choose “Resize or Autoscale”.
The dialog lets you select from a fixed node count (the default) or automatic scaling. When using the “Fixed size” option, you specify the exact number of nodes to use.
Select the “Autoscale” radio button to define a minimum to maximum range for the node count. Additional nodes will be added and removed automatically based on the resource usage of your cluster’s workloads.
You can view the activity within your cluster by clicking the “Insights” tab at the top of the screen. This defaults to cluster-level metrics for key statistics such as CPU usage and network bandwidth. Use the “Select object” dropdown to drill down to a specific node or pool.
More Management Options
DigitalOcean’s platform has built-in support for the Kubernetes Dashboard, the official web UI from the Kubernetes project. Click the “Kubernetes Dashboard” button in the top right to launch the app in a new tab. It’ll be preconfigured with a valid authentication token.
DigitalOcean also offers automatic cluster upgrades. Click the “Settings” tab at the top of the screen. Next, press “Enable automatic upgrades”. Click the “Edit” button to customise the acceptable update timeframe.
DigitalOcean will now automatically apply Kubernetes patch updates to your cluster. You’ll be notified when new major versions are available. When they are, a one-click upgrade button will be offered within the interface.
You can delete your cluster at any time using the “Destroy” button on the Settings screen. This will delete all the compute resources associated with the cluster. Some peripheral objects, such as block storage volumes and network load balancers, may need to be manually removed.
That’s all there is to creating a Kubernetes cluster on DigitalOcean. It’s important to note that Kubernetes-managed resources will display elsewhere in your DigitalOcean Control Panel (for example, nodes will show up in the “Droplets” management interface). Don’t modify the properties of these resources directly – use the Kubernetes interface instead to ensure they remain consistent with the expectations of the Kubernetes control plane.
- › How to Test Your Computer’s PSU With a PSU Tester
- › Why You Should Be Using ‘Movies Anywhere’
- › How to Change Apple ID on iPhone
- › How to Use Your Apple Watch’s Hidden Web Browser (and Why You Shouldn’t)
- › How to Batch Edit Photos and Videos on iPhone
- › Why Mario Kart Just Isn’t as Fun as It Used to Be