Terraform Kubernetes: kubernetes storage class v1

From wikieduonline
Jump to navigation Jump to search

Example

Official example

resource "kubernetes_storage_class" "example" {
  metadata {
    name = "terraform-example"
  }
  storage_provisioner = "kubernetes.io/gce-pd"
  reclaim_policy      = "Retain"
  parameters = {
    type = "pd-standard"
  }
  mount_options = ["file_mode=0700", "dir_mode=0777", "mfsymlinks", "uid=1000", "gid=1000", "nobrl", "cache=none"]
}

AWS EBS example

 resource "kubernetes_storage_class_v1" "this" {
   metadata {
     name = "ebs-sc"
     annotations = {
       "storageclass.kubernetes.io/is-default-class" = "true"
     }
   }
   storage_provisioner    = "ebs.csi.aws.com"
   volume_binding_mode    = "WaitForFirstConsumer"
   allow_volume_expansion = true
   parameters = {
     type      = "gp3"
     encrypted = "true"
   }
 }

Errors

Advertising: