This directory provides an example flow for using k0sctl with Terraform and AWS.
- Create terraform.tfvars file with needed details. You can use the provided terraform.tfvars.example as a baseline.
terraform init
- (optional Create a Terraform Workspace).
terraform workspace new cluster1
terraform apply
terraform output -raw k0s_cluster | k0sctl apply --config -
terraform output -raw k0s_cluster | k0sctl kubeconfig --config - > kubeconfig-$(terraform workspace show)
- Test your cluster.
KUBECONFIG=$(pwd)/kubeconfig-$(terraform workspace show) kubectl get nodes
- Label each controller node
kubectl label node <controller> node-role.kubernetes.io/master=
- Taint controller nodes
kubectl taint nodes -l node-role.kubernetes.io/master= node-role.kubernetes.io/master:NoSchedule
- Deploy CloudControllerManager.
kubectl apply -f ccm.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.0.3/deploy/static/provider/aws/deploy.yaml
export EXTERNAL_DNS=$(kubectl get services --namespace ingress-nginx ingress-nginx-controller --output jsonpath='{.status.loadBalancer.ingress[0].hostname}')
envsubst < dockerdemo.yaml | kubectl apply -f -
curl -k https://${EXTERNAL_DNS}
kubectl delete -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.0.3/deploy/static/provider/aws/deploy.yaml
terraform destroy