Managing Kubernetes objects on GKE with Terraform

Authentication

provider "kubernetes" {
}
provider "kubernetes" {
config_context_auth_info = "ops"
config_context_cluster = "mycluster"
}
provider "kubernetes" {
host = "https://104.196.242.174"

client_certificate = "${file("~/.kube/client-cert.pem")}"
client_key = "${file("~/.kube/client-key.pem")}"
cluster_ca_certificate = "${file("~/.kube/cluster-ca-cert.pem")}"
}
provider "kubernetes" {
host = "https://104.196.242.174"

username = "username"
password = "password"
}

Managing namespaces on GKE

gcloud beta container clusters get-credentials <cluster_name> --region <region> --project <project_id>
provider "kubernetes" {
version = "1.10"
}
resource "kubernetes_namespace" "app" {
metadata {
labels = {
name = "app"
}
name = "app"
}
}

Conclusion

--

--

--

Brazilian Software Engineer living in London. Java addicted. Clean Code and Software craftsmanship Enthusiast. Cloud. https://www.linkedin.com/in/femrtnz/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

LENGTH OF LONGEST INCREASING SUB-SEQUENCE

The Zoo of Go Functions

ESP32 Project #8 Wi-Fi Controlling Devices

Deploying Java EE apps to Azure: Part 2

What happens when you look up a URL

YugaByte DB 1.2 Passes Jepsen Testing

Top Quotes from Cloud Foundry Summit North America 2020

How to Reset APOLLO Quicki 731

Hard reset Samsung galaxy

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Felipe Martinez

Felipe Martinez

Brazilian Software Engineer living in London. Java addicted. Clean Code and Software craftsmanship Enthusiast. Cloud. https://www.linkedin.com/in/femrtnz/

More from Medium

Terraform — Best practices and project setup

Debugging/Logging in Terraform

Tagging Strategy in Terraform

Run you Azure DevOps pipelines in Kubernetes pods “ Self-Hosted Agents ”.