How do I deploy a GKE Workload with my Docker image from the Artifact Registry using Terraform?

Viewed 52

I have a kubernetes cluster that I have stood up with terraform in GCP. Now I want to deploy/run my Docker image to/on it, from the GCP console I would do this by going to the workloads section of the kubernetes engine portion of the console and then selecting Deploy a containerized application, I however want to do this with terraform, and am having difficulty determining how to do this and finding good reference examples for how to do it. Any examples on how to do this would be appreciated.

Thank you!

1 Answers

You need to do 2 things:

  • For managing workloads on Kubernetes, you can use this Kubectl Terraform provider
  • For custom images that preset in a 3rd party registry, you'll need to create a Kubernetes secret of type Docker and then use it in your manifests via imagePullSecrets attribute. Check out this example.
Related