mirror of
https://github.com/funkypenguin/geek-cookbook/
synced 2025-12-12 17:26:19 +00:00
78 lines
3.9 KiB
Markdown
78 lines
3.9 KiB
Markdown
---
|
|
description: Creating a Kubernetes cluster on DigitalOcean
|
|
---
|
|
# Kubernetes on DigitalOcean
|
|
|
|
IMO, the easiest Kubernetes cloud provider to experiment with is [DigitalOcean](https://m.do.co/c/e33b78ad621b) (_this is a referral link_). I've included instructions below to start a basic cluster.
|
|
|
|

|
|
|
|
## Ingredients
|
|
|
|
1. [DigitalOcean](https://www.digitalocean.com/?refcode=e33b78ad621b) account, either linked to a credit card or (_my preference for a trial_) topped up with $5 credit from PayPal. (_yes, this is a referral link, making me some 💰 to buy 🍷_)
|
|
2. Geek-Fu required : 🐱 (easy - even has screenshots!)
|
|
|
|
## Preparation
|
|
|
|
### Create DigitalOcean Account
|
|
|
|
Create a project, and then from your project page, click **Manage** -> **Kubernetes (LTD)** in the left-hand panel:
|
|
|
|
{ loading=lazy }
|
|
|
|
Until DigitalOcean considers their Kubernetes offering to be "production ready", you'll need the additional step of clicking on **Enable Limited Access**:
|
|
|
|
{ loading=lazy }
|
|
|
|
The _Enable Limited Access_ button changes to read _Create a Kubernetes Cluster_ . Cleeeek it:
|
|
|
|
{ loading=lazy }
|
|
|
|
When prompted, choose some defaults for your first node pool (_your pool of "compute" resources for your cluster_), and give it a name. In more complex deployments, you can use this concept of "node pools" to run certain applications (_like an inconsequential nightly batch job_) on a particular class of compute instance (_such as cheap, preemptible instances_)
|
|
|
|
{ loading=lazy }
|
|
|
|
That's it! Have a sip of your 🍷, a bite of your :cheese:, and wait for your cluster to build. While you wait, follow the instructions to setup kubectl (if you don't already have it)
|
|
|
|
{ loading=lazy }
|
|
|
|
DigitalOcean will provide you with a "kubeconfig" file to use to access your cluster. It's at the bottom of the page (_illustrated below_), and easy to miss (_in my experience_).
|
|
|
|
{ loading=lazy }
|
|
|
|
## Release the kubectl!
|
|
|
|
Save your kubeconfig file somewhere, and test it our by running ```kubectl --kubeconfig=<PATH TO KUBECONFIG> get nodes``` [^1]
|
|
|
|
Example output:
|
|
|
|
```bash
|
|
[davidy:~/Downloads] 130 % kubectl --kubeconfig=penguins-are-the-sexiest-geeks-kubeconfig.yaml get nodes
|
|
NAME STATUS ROLES AGE VERSION
|
|
festive-merkle-8n9e Ready <none> 20s v1.13.1
|
|
[davidy:~/Downloads] %
|
|
```
|
|
|
|
In the example above, my nodes were being deployed. Repeat the command to see your nodes spring into existence:
|
|
|
|
```bash
|
|
[davidy:~/Downloads] % kubectl --kubeconfig=penguins-are-the-sexiest-geeks-kubeconfig.yaml get nodes
|
|
NAME STATUS ROLES AGE VERSION
|
|
festive-merkle-8n96 Ready <none> 6s v1.13.1
|
|
festive-merkle-8n9e Ready <none> 34s v1.13.1
|
|
[davidy:~/Downloads] %
|
|
|
|
[davidy:~/Downloads] % kubectl --kubeconfig=penguins-are-the-sexiest-geeks-kubeconfig.yaml get nodes
|
|
NAME STATUS ROLES AGE VERSION
|
|
festive-merkle-8n96 Ready <none> 30s v1.13.1
|
|
festive-merkle-8n9a Ready <none> 17s v1.13.1
|
|
festive-merkle-8n9e Ready <none> 58s v1.13.1
|
|
[davidy:~/Downloads] %
|
|
```
|
|
|
|
That's it. You have a beautiful new kubernetes cluster ready for some action!
|
|
|
|
[^1]: Do you live in the CLI? Install the kubectl autocompletion for [bash or zsh](https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/) to make your life much easier!
|
|
|
|
--8<-- "recipe-footer.md"
|