Codebase to create a simple DOKS cluster with terraform and Nginx Ingress Controller:
- Generate your Access Token to Digital Ocean
- Terraform
- (Optional)Digital Ocean CLI - doctl
- (Optional)Kubectl
This process initialize Digital Ocean kubernetes cluster with node pools and deploy Nginx Ingress controller.
# Generate your access token here: https://cloud.digitalocean.com/account/api/tokens
# Edit do_token inside terraform.tfvars
(~) $ terraform init
(~) $ cp terraform.tfvars.example terraform.tfvars
(~) $ terraform apply
Waiting terraform finish and open Load Balance Console to get LB IP.
After completion, add the k8s settings made in DO to your .kube/config. We use the doctl doctl is the official DigitalOcean command line interface (CLI).
(~) $ kubernetes cluster kubeconfig save <your-cluster-name>
Follow Digital ocean instructions to get your kubeconfig an interact with cluster, recommended Lens - K8S IDE.
- Create specific firewall inside process.
- An apps folder to maintain all manifests inside same repo.
- Terraform Destroy stuck in a invalid state because delete cluster before Nginx ingress not destroying Loadbalancer created, need enter in Load Balance Console and finish.
- https://www.padok.fr/en/blog/digitalocean-kubernetes
- https://registry.terraform.io/providers/digitalocean/digitalocean/latest/docs#example-usage
- https://github.com/sergsoares/lab-tf-k8s
- https://www.udemy.com/course/terraform-na-pratica/
- https://registry.terraform.io/providers/hashicorp/helm/latest/docs
- https://docs.nginx.com/nginx-ingress-controller/installation/installation-with-helm/