Example of running hello-world on okteto-cloud using pure terraform
Prerequisites
Steps:
- Clone repo:
git clone [email protected]:jhole89/terraform-k8s-example.git
- Change to this directory:
cd okteto-hello-world
- Initialise terraform:
terraform init
- Copy tfvars template:
cp terraform.tfvars.template terraform.tfvars
- Fill in
terraform.tfvars
with Okteto values (found in yourokteto-kube.config
- make sure yourokteto-kube.config
is also in your~/.kube/config
) - Apply terraform plan:
tf apply --auto-approve
- you should see the following outputkubernetes_deployment.example_deployment: Creating... kubernetes_deployment.example_deployment: Creation complete after 5s [id=jhole89/hello-world-deployment] kubernetes_service.example_service: Creating... kubernetes_service.example_service: Creation complete after 0s [id=jhole89/hello-world-service] Apply complete! Resources: 2 added, 0 changed, 0 destroyed. Outputs: url = https://hello-world-service-jhole89.cloud.okteto.net/
- The plan outputs the
url
exposed through the kubernetes service. You can now hit the endpoint using curl:curl https://hello-world-service-jhole89.cloud.okteto.net/
- Once no longer required you can remove all resources:
terraform destroy --auto-approve