This repository showcases using Terraform to provision a new DigitalOcean VPC, and managed Kubernetes cluster with nodes within.
Setup doctl
on your system, and initialise auth:
doctl auth init
When requested, enter a token generated from the Applications & API section of the DigitalOcean dashboard.
Now export the token as an environment variable so Terraform can find it:
export TF_VAR_do_token=YOUR_TOKEN_HERE
name
and region
are required. cluster_version
specifies the Kubernetes version to use (currently defaults to 1.18
.)
doctl kubernetes options regions
shows which regions are available, use the slug value forregion
.doctl kubernetes options versions
shows which Kubernetes versions are available, use the slug value forcluster_version
.
terraform init
terraform apply
Retrieve the kubeconfig using doctl
(replacing mycluster
with the name you specified in terraform.tfvars
):
doctl kubernetes cluster kubeconfig save mycluster
kubectl get nodes -o wide
terraform destroy
See the Kubernetes on DigitalOcean documentation for general information on the service, and Kubernetes on DigitalOcean resources for guides and tutorials on building and operating Kubernetes. You might also want to check out a guide on upgrading DigitalOcean Kubernetes clusters.
Some examples of integrations with DigitalOcean you can configure: