Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Terraform Operator for Kubernetes

Terraform Operator for Kubernetes

Originally presented at the St. Louis HashiCorp User Group.

This presentation outlines some of the use cases and workflows in the Terraform Operator for Kubernetes.

Rosemary Wang

May 13, 2020
Tweet

More Decks by Rosemary Wang

Other Decks in Technology

Transcript

  1. PUBLIC CLOUD STAGING STAGING QUEUE STAGING DEAD LETTER QUEUE PRODUCTION

    PRODUCTION QUEUE PRODUCTION DEAD LETTER QUEUE
  2. Service Catalog PUBLIC CLOUD APPLICATION QUEUE DEAD LETTER QUEUE SERVICE

    BROKER SERVICE CATALOG SERVICE INSTANCE CREATE READ UPDATE DELETE kubernetes.io/docs/concepts/extend-kubernetes/service-catalog/
  3. “An Operator extends Kubernetes to automate the management of the

    entire lifecycle of a particular application.” Kubernetes Operators by Jason Dobies & Joshua Wood
  4. Operator Pattern ▪ Bullet One ▪ Bullet Two ▪ Bullet

    Three ▪ Bullet Four ▪ Bullet Five ▪ Bullet Six FRONTEND PERSISTENT VOLUME BACKEND OPERATOR MYAPP CUSTOM RESOURCE DAY 1-2 API: V1 KIND: MYAPP SPEC: FRONTEND: REPLICAS: 1 (OR 2) IMAGE: FRONTEND BACKEND: REPLICAS: 1 IMAGE: BACKEND VOLUME_SIZE: 1G DAY 3 SNAPSHOT PERSISTENT VOLUME LIST METADATA FOR SNAPSHOTS kubernetes.io/docs/concepts/extend-kubernetes/operator/
  5. PUBLIC CLOUD MYAPP QUEUE DEAD LETTER QUEUE OPERATOR MYAPP CUSTOM

    RESOURCE DAY 1-2 API: V1 KIND: MYAPP-INFRA SPEC: QUEUE: NAME: MYAPP DLQ: NAME: MYAPP-DLQ TYPE: FIFO MESSAGES: 10 DAY 3 ADD MESSAGES TO STAGING QUEUE FOR TESTING UPDATE QUEUES
  6. PRIVATE DATACENTER MYAPP LOAD BALANCER DATABASE OPERATOR MYAPP CUSTOM RESOURCE

    DAY 1-2 API: V1 KIND: MYAPP-INFRA SPEC: LB: NAME: MYAPP DATABASE: NAME: MYAPP-DLQ SIZE: 1G TYPE: MYSQL DAY 3 REGISTER NEW INSTANCES OF APP TO LOAD BALANCER DB TEST CORPUS
  7. PUBLIC CLOUD MYAPP OPERATOR MYAPP CUSTOM RESOURCE DAY 1-2 API:

    V1 KIND: MYAPP-INFRA SPEC: MODULE: SOURCE: QUEUES VERSION: 1.0.0 VARIABLES: NAME: MYAPP DAY 3 ENFORCE TAGS FOR QUEUES ADD QUEUE ENCRYPTION TERRAFORM CLOUD REGISTRY “QUEUEAPP-INFRA” MODULE QUEUE DEAD LETTER QUEUE MYAPP-QUEUE MYAPP-DLQ WORKSPACE “MYAPP-INFRA” SENTINEL POLICY PLAN APPLY
  8. MYAPP OPERATOR MYAPP CUSTOM RESOURCE DAY 1-2 API: V1 KIND:

    MYAPP-INFRA SPEC: MODULE: SOURCE: QUEUES VERSION: 1.0.0 VARIABLES: NAME: MYAPP DAY 3 TUNE LOAD BALANCER UPDATE DATABASE ROLES TERRAFORM ENTERPRISE REGISTRY “WEBAPP-INFRA” MODULE MYAPP-LB MYAPP-DB WORKSPACE “MYAPP-INFRA” PLAN APPLY SENTINEL POLICY PRIVATE DATACENTER LOAD BALANCER DATABASE
  9. Self-Service Configure infrastructure required by application using Kubernetes interface (Should

    I bundle infrastructure code with application?) Common Architecture Use modules to enable common architecture. (How do I build a queue / database?) Security & Compliance Ensure all provisioned infrastructure is secure and compliant. (Is this infrastructure configuration secure and compliant?)
  10. OPERATIONS TERRAFORM MODULE NEW MODULE VERSION TERRAFORM WORKSPACE DEVELOPER WORKSPACE

    CUSTOM RESOURCE OPERATOR RUN ID, STATUS VARIABLES, MODULE RUN ID, STATUS WORKSPACE VARIABLES CONFIGURATION UPDATE TO USE NEW MODULE VERSION PLAN APPLY