Difference between revisions of "Terraform Kubernetes: kubernetes storage class v1"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
  kubernetes_storage_class_v1
 
  kubernetes_storage_class_v1
 
* https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/storage_class
 
* https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/storage_class
== Official example ==
+
== Example ==
 +
 
 +
=== Official example ===
 
<pre>
 
<pre>
 
resource "kubernetes_storage_class" "example" {
 
resource "kubernetes_storage_class" "example" {
Line 16: Line 18:
 
</pre>
 
</pre>
  
 +
=== [[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 ==
 
== Errors ==
Line 30: Line 49:
  
  
 
+
== See also ==
 
* {{tf K8s}}
 
* {{tf K8s}}
 
* {{EKS addons}}
 
* {{EKS addons}}
 +
 +
 +
[[Category:TF]]

Latest revision as of 09:12, 20 March 2023

kubernetes_storage_class_v1

Example[edit]

Official example[edit]

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[edit]

 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[edit]

╷ 
│ Error: Post "http://localhost/apis/storage.k8s.io/v1/storageclasses": dial tcp [::1]:80: connect: 
connection refused
│
│   with module.eks.kubernetes_storage_class_v1.this,
│   on .terraform/modules/eks/main.tf line 111, in resource "kubernetes_storage_class_v1" "this":
│  111:   resource "kubernetes_storage_class_v1" "this" {
│
╵


See also[edit]

Advertising: