ibm-object-storage-plugin

by joaquinito2051

Helm chartv2.2.61App 2.2.61Apache-2.0

Chart for deploying ibmcloud object storage plugin. IBM Cloud Object Storage is persistent, highly available storage that you can mount to apps that run in a Kubernetes cluster by using the IBM Cloud Object Storage plug-in. The plug-in is a Kubernetes Flex-Volume plug-in that connects Cloud Object Storage buckets to pods in your cluster. License By installing this product you accept the following license terms: http://www.apache.org/licenses/ and https://www.redhat.com/licenses/EULA_Red_Hat_Universal_Base_Image_English_20190422.pdf

About this chart

IBM Cloud Object Storage Plug-in

This Helm chart installs the IBM Cloud Object Storage plug-in in a Kubernetes cluster. In IBM Cloud Kubernetes Service, the Helm chart is deployed in the ibm-object-s3fs namespace of your cluster.

Supported orchestration platforms

The following table details orchestration platforms suitable for deployment of the IBM Cloud Object Storage Plug-in.

Orchestration platformVersionArchitecture
Kubernetes1.31x86
Kubernetes1.32x86
Kubernetes1.33x86
Kubernetes1.34x86
Kubernetes1.35x86
Kubernetes1.36x86
Kubernetes1.37x86
Red Hat OpenShift®4.16x86
Red Hat OpenShift4.17x86
Red Hat OpenShift®4.18x86
Red Hat OpenShift4.19x86
Red Hat OpenShift4.20x86
Red Hat OpenShift4.21x86
Red Hat OpenShift4.22x86

Introduction

IBM Cloud Object Storage is persistent, highly available storage that you can mount to apps that run in a Kubernetes cluster by using the IBM Cloud Object Storage plug-in. The plug-in is a Kubernetes Flex-Volume plug-in that connects Cloud Object Storage buckets to pods in your cluster. Information that is stored with IBM Cloud Object Storage is encrypted in transit and at rest, dispersed across multiple geographic locations, and accessed over HTTP by using a REST API.


Chart Details

When you install the IBM Cloud Object Storage plug-in Helm chart, the following Kubernetes resources are deployed into your Kubernetes cluster:

  • IBM Cloud Object Storage driver daemonset: The daemonset deploys one ibmcloud-object-storage-driver pod on every worker node in your cluster. The daemonset contains the Kubernetes flex driver plug-in to communicate with the kubelet component in your cluster.
  • IBM Cloud Object Storage plug-in pod: The pod contains the storage provisioner controllers to work with the Kubernetes controllers.
  • IBM-provided storage classes: You can use the storage classes to create Cloud Object Storage buckets with a specific configuration.
  • Kubernetes service accounts, RBAC cluster roles and cluster role bindings: The service accounts and RBAC roles authorize the plug-in to interact with your Kubernetes resources.

Prerequisites

SecurityContextConstraints Requirements

  • The chart automatically creates following SCC, s3fs-cos-driver-scc, for OpenShift Container Platform (OCP) to provide the required permissions & capabilities to the Driver Pods
    • Custom SecurityContextConstraints definition:
      apiVersion: security.openshift.io/v1
      kind: SecurityContextConstraints
      metadata:
        name: s3fs-cos-driver-scc
      priority: 0
      defaultAddCapabilities: []
      allowedCapabilities: []
      allowHostDirVolumePlugin: true
      allowHostIPC: false
      allowHostPID: false
      allowHostPorts: false
      allowHostNetwork: true
      allowPrivilegedContainer: false
      allowPrivilegeEscalation: true
      requiredDropCapabilities:
       - KILL
       - MKNOD
       - SETUID
       - SETGID
      readOnlyRootFilesystem: true
      runAsUser:
        type: RunAsAny
      seLinuxContext:
        type: MustRunAs
      fsGroup:
        type: RunAsAny
      supplementalGroups:
        type: RunAsAny
      users:
      - system:serviceaccount:{{template "ibm-object-storage-plugin.namespace" .}}:ibmcloud-object-storage-driver
      groups: []
      volumes:
        - configMap
        - downwardAPI
        - emptyDir
        - hostPath
        - persistentVolumeClaim
        - projected
        - secret
      

Permissions

To install the Helm chart in your cluster, you must have the Administrator platform role.

Resources Required

The IBM Cloud Object Storage plug-in requires the following resources on each worker node to run successfully:

  • CPU: 0.2 vCPU
  • Memory: 128MB

Installing the Chart

Install the IBM Cloud Object Storage plug-in with a Helm chart to set up pre-defined storage classes for IBM Cloud Object Storage. You can use these storage classes to create a PVC to provision IBM Cloud Object Storage for your apps.

Before you begin

  1. Complete the prerequisites for your IBM Cloud environment as outlined in the Prerequisites section of this README.
  2. Create a Cloud Object Storage instance that you want to use to store your data.
    • Option 1: Create an IBM Cloud Object Storage service instance in IBM Cloud. The service provides a public and a private service endpoint. In IBM Cloud Kubernetes Service, the private endpoint is used by default. However, you can specify the public service endpoint in your PVC instead. To connect to the private service endpoint, you must be on the IBM network, for example by using a VPN gateway.
    • Option 2: Set up a local Cloud Object Storage server in your cluster. For example, check out the ibm-minio-objectstore Helm chart.
    • Option 3: Create or use an existing Cloud Object Storage instance that you set up with a different cloud provider, such as Amazon s3.
  3. Retrieve your Cloud Object Storage API endpoint, and the credentials to access your Cloud Object Store. For example, to retrieve this information for an IBM Cloud Object Storage service instance in IBM Cloud (Option 1), see Retrieve the IBM Cloud Object Storage service credentials.
  4. Store the credentials to access your Cloud Object Store in a Kubernetes secret.
    1. Encode the Cloud Object Storage credentials to base64 and note all the base64 encoded values.

      echo -n "<key_value>" | base64
      
    2. Create a configuration file for your Kubernetes secret. The credentials might vary depending on the type of Cloud Object Storage instance you use. The following examples show the values that you must provide if you use an IBM Cloud Object Storage service instance in IBM Cloud. You can create the secret, say secret.yaml in any namespace that you want. Example for Hash-based Message Authentication Code (HMAC) authentication:

      apiVersion: v1
      kind: Secret
      type: ibm/ibmc-s3fs
      metadata:
        name: <secret_name>
        namespace: <namespace>
      data:
        access-key: <base64_access_key_id>
        secret-key: <base64_secret_access_key>
      

      Example for Identity and Access Management (IAM) key authentication:

      apiVersion: v1
      kind: Secret
      type: ibm/ibmc-s3fs
      metadata:
        name: <secret_name>
        namespace: <namespace>
      data:
        api-key: <base64_apikey>
        service-instance-id: <base64_resource_instance_id>
      
    3. Create the Kubernetes secret in your cluster.

      kubectl apply -f secret.yaml
      

Installing the Chart

  • Go to IBM Cloud Kubernetes Service for deployment on IKS Cluster

IBM Cloud Kubernetes Service

Note: This chart supports only Helm V3 and will not work with Helm V2

  1. Verify that helm v3 is installed on your local machine.

    helm version --short
    v3.0.2+g19e47ee
    

    Tip: If helm v2 is installed on your local machine or on your cluster, then first migrate from helm v2 to v3.

  2. Add the IBM Cloud Helm repository ibm-helm to your cluster.

    helm repo add ibm-helm https://raw.githubusercontent.com/IBM/charts/master/repo/ibm-helm
    
  3. Update the Helm repo to retrieve the latest version of all Helm charts in this repo.

    helm repo update
    
  4. Download the Helm chart and unpack the chart in your current directory. Then, navigate to the ibm-object-storage-plugin directory.

    helm pull --untar ibm-helm/ibm-object-storage-plugin && cd ibm-object-storage-plugin
    
  5. To limit the IBM Cloud Object Storage plug-in access to Kubernetes secrets, go to Optional: Limit secret access ; otherwise, if there is no limitation to be set, continue with next step.

  6. Install the IBM Cloud Object Storage Helm plug-in ibmc. The plug-in is used to automatically retrieve your cluster location and to set the Cloud Object Storage s3 API endpoint for your IBM Cloud Object Storage buckets in your storage classes.

    1. Install the ibmc Helm plug-in.

      helm plugin install ./helm-ibmc
      

      Example output:

      Installed plugin: ibmc
      
    2. Verify that the ibmc plug-in is installed successfully.

      helm ibmc --help
      
  7. Install the IBM Cloud Object Storage plug-in. When you install the plug-in, pre-defined storage classes are added to your cluster.

    Important note1: The bucket access policy configuration, to configure authorised ips, has been enabled only for VPC-Gen2 clusters. Currently, this feature is not supported on IKS Classic. The feature has been enabled by default for VPC-Gen2 clusters in eu-fr2 region. For other regions, to enable bucket access policy, pass the flag --set bucketAccessPolicy=true to helm ibmc install command.

    Important note2: If bucketAccessPolicy is set to true, the s3fs plugin gets installed in kube-system namespace. This is because, to enable access policy for buckets, plugin needs access to cluster-info config-map which lies in kube-system ns.

    Example: Install chart from helm registry, without any limitation to access specific Kubernetes secrets:

     helm ibmc install ibm-object-storage-plugin ibm-helm/ibm-object-storage-plugin --set license=true
    

    Example: Install chart from local path, with a limitation to access the Cloud Object Storage's secrets only, as described in the Optional: Limit secret access section at the bottom:

    helm ibmc install ibm-object-storage-plugin ./ --set license=true
    

    Example: Install chart from helm registry, with bucket access policy feature enabled (for regions other than eu-fr2)

     helm ibmc install ibm-object-storage-plugin ibm-helm/ibm-object-storage-plugin --set license=true --set bucketAccessPolicy=true
    
  8. Go to Limit secret access

Optional: Limit secret access

Limit the IBM Cloud Object Storage plug-in to access only the Kubernetes secrets that hold your IBM Cloud Object Storage service credentials. By default, the plug-in is authorized to access all Kubernetes secrets in your cluster.

  1. Navigate to the templates directory and list available files.
    cd ./templates && ls
    
  2. Open the provisioner-sa.yaml file and look for the ibmcloud-object-storage-secret-reader ClusterRole definition.
  3. Add the name of the secret that you created earlier to the list of secrets that the plug-in is authorized to access in the resourceNames section.
    kind: ClusterRole
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
      name: ibmcloud-object-storage-secret-reader
    rules:
    - apiGroups: [""]
      resources: ["secrets"]
      resourceNames: ["<secret_name1>","<secret_name2>"]
      verbs: ["get"]
    
  4. Save your changes.
  5. Navigate back to the ibm-object-storage-plugin directory.
  6. Go back to Installing the Chart section and continue with chart installation.

Verifying the Chart

  1. Verify that the IBM Cloud Object Storage plug-in is installed correctly.
    kubectl get pod -n <namespace> -o wide | grep object
    
    Example output:
    $ kubectl get pods -n ibm-object-s3fs -o wide | grep object
    ibmcloud-object-storage-driver-nss6g              1/1     Running   0          2m7s   10.216.37.8      10.216.37.8    <none>           <none>
    ibmcloud-object-storage-driver-qsnh8              1/1     Running   0          2m7s   10.216.37.14     10.216.37.14   <none>           <none>
    ibmcloud-object-storage-plugin-7644559d65-4b2dr   1/1     Running   0          2m7s   172.30.207.136   10.216.37.14   <none>           <none>
    
    The installation is successful when you see one ibmcloud-object-storage-plugin pod and one or more ibmcloud-object-storage-driver pods. The number of ibmcloud-object-storage-driver pods equals the number of worker nodes in your cluster. All pods must be in a Running state for the plug-in to function properly. If the pods

Deploy ibm-object-storage-plugin with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has ibm-object-storage-plugin on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartibm-object-storage-plugin is pinned at v2.2.61 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply