Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Last active January 18, 2022 00:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vfarcic/e41dde56f46824bdf6abb4b13491ea20 to your computer and use it in GitHub Desktop.
Save vfarcic/e41dde56f46824bdf6abb4b13491ea20 to your computer and use it in GitHub Desktop.
# Requirements:
# git: https://git-scm.com/
# terraform: https://www.terraform.io/downloads.html
# kubectl: https://kubernetes.io/docs/tasks/tools/install-kubectl/
# helm: https://helm.sh/docs/using_helm/
# doctl: https://github.com/digitalocean/doctl
# DigitalOcean: https://www.digitalocean.com/ account with admin privileges
# GitBash (if Windows)
# Open https://github.com/terraform-providers/terraform-provider-digitalocean/graphs/contributors
git clone https://github.com/vfarcic/k8s-specs.git
cd k8s-specs
git pull
cd terraform/doks
cat cluster.tf
doctl compute region list
terraform init
# Use the instructions in https://www.digitalocean.com/docs/api/create-personal-access-token/ to generate the token
# Store the token inside the `token` file.
# Make sure that it does not contain any extra lines.
doctl auth init \
--access-token $(cat token)
doctl kubernetes options versions
export VERSION=[...]
terraform apply \
--var k8s_version=$VERSION
export KUBECONFIG=$PWD/kubeconfig
doctl kubernetes cluster \
kubeconfig save devops-paradox
kubectl get nodes
git clone \
https://github.com/vfarcic/devops-toolkit.git
cd devops-toolkit
helm template charts/devops-toolkit \
--name devops-toolkit \
--output-dir $PWD \
--set replicaCount=25 \
--set image.repository=vfarcic/devops-toolkit-series \
--set image.tag=latest \
--set domain=false
kubectl apply \
--filename devops-toolkit \
--recursive
cd ..
kubectl get pods
terraform apply \
--var k8s_version=$VERSION \
--var node_count=6
kubectl get nodes
kubectl get pods
kubectl version --output yaml
doctl kubernetes options versions
export VERSION=[...]
export KUBECONFIG=$PWD/kubeconfig
watch --interval 10 \
"kubectl get pods,nodes"
terraform apply \
--var k8s_version=$VERSION \
--var node_count=6
doctl kubernetes cluster list
export CLUSTER_ID=[...]
doctl kubernetes cluster \
upgrade $CLUSTER_ID \
--version $VERSION
doctl kubernetes cluster get $CLUSTER_ID
terraform destroy \
--var k8s_version=$VERSION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment