Slide 1

Slide 1 text

Copyright © 2020 HashiCorp Understanding the Kubernetes Provider For Terraform

Slide 2

Slide 2 text

Kerim Satirli (He/Him) Developer Advocate at HashiCorp

Slide 3

Slide 3 text

@ksatirli on GitHub and Twitter Developer Advocate at HashiCorp

Slide 4

Slide 4 text

Taylor Dolezal (He/Him) Developer Advocate at HashiCorp

Slide 5

Slide 5 text

@onlydole on GitHub and Twitter Developer Advocate at HashiCorp

Slide 6

Slide 6 text

Introduction to Terraform

Slide 7

Slide 7 text

Infrastructure as Code ▪ executable documentation ▪ enables collaboration ▪ safe and predictable

Slide 8

Slide 8 text

Terraform 135+ Official Providers AWS, GCP, Datadog, etc. 200+ Community Providers 1Password, Stripe, Unifi, etc.

Slide 9

Slide 9 text

HashiCorp Configuration Language CODE EDITOR service "http" "web_proxy" { listen_addr = "127.0.0.1:8080" process "server" { command = ["proxy-app", "server"] } } variable "port" { description = "Port for web_proxy" default = 8080 }

Slide 10

Slide 10 text

HashiCorp Configuration Language CODE EDITOR service "http" "web_proxy" { listen_addr = "127.0.0.1:${var.port}" process "server" { command = ["proxy-app", "server"] } } variable "port" { description = "Port for web_proxy" default = 8080 }

Slide 11

Slide 11 text

Kubernetes Namespaces everything has a home Services exposes Deployments Deployments declarative updates Nodes machines

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Creating a Namespace CODE EDITOR resource "kubernetes_namespace" "beacon" { name = "beacon" metadata { name = "beacon" } }

Slide 16

Slide 16 text

Creating a Deployment CODE EDITOR resource "kubernetes_deployment" "beacon" { metadata { name = "beacon" namespace = kubernetes_namespace.beacon.id spec { container { image = "onlydole/beacon:1.19.1" name = "beacon" } } }

Slide 17

Slide 17 text

Creating a Service CODE EDITOR resource "kubernetes_service" "beacon" { metadata { name = "beacon" namespace = kubernetes_namespace.beacon.id spec { selector { app = kubernetes_deployment.beacon.metadata.0.labels.app } } ...

Slide 18

Slide 18 text

Creating a Service CODE EDITOR ... port { port = 8080 target_port = 80 } type = "LoadBalancer" }

Slide 19

Slide 19 text

Command: terraform apply TERMINAL > terraform apply "kubernetes.tfplan" Apply complete! Resources: 3 added, 0 changed, 0 destroyed.

Slide 20

Slide 20 text

Beacon your.app.url:8080

Slide 21

Slide 21 text

Review ▪ Terraform and IaC ▪ Kubernetes Concepts ▪ Kubernetes Resources

Slide 22

Slide 22 text