The storage-operator component is used to manage the lifecycle of storage components. You can modify the ConfigMap of the storage-operator component to deploy and update storage components. This reduces the complexity of container development and maintenance. This topic describes how to configure storage components and deploy storage-operator in a Container Service for Kubernetes (ACK) cluster.
Introduction
storage-operator runs as a Deployment, which deploys and updates storage components based on the default configurations inherited from the image and the custom configurations provided by a ConfigMap.
The storage-operator component can be used only in ACK clusters.
Default configurations: storage-operator provides the default configurations of storage components. The default configurations vary based on the version of storage-operator.
Custom configurations: ConfigMaps can be used to define custom configurations of storage components, such as version information and whether to install the component.
storage-operator preferably uses custom configurations. The default configurations are used only when the custom configurations are not specified.
Each image of storage-operator contains the default configuration file.
When storage-operator runs as a Deployment, the Deployment reads configurations from a ConfigMap that is mounted on the Deployment and that contains configurations of storage components.
storage-operator determines whether to deploy and update a storage component by combining the default and custom configurations.
Step 1: Configure the components
Method 1: Use the default configurations provided by the image
ACK supports the following storage components: storage-snapshot-manager, storage-analyzer, storage-auto-expander, and storage-monitor.
storage-operator provides the default configurations of storage components. The default configurations vary based on the version of storage-operator. In this example, v1.18.8.0 is used.
{
"storage-snapshot-manager": {
"install": "true",
"imageTag": "v1.18.8.0-81508da-aliyun",
"imageRep": "acs/storage-snapshot-manager",
"template": "/acs/templates/storage-snapshot-manager/install.yaml"
},
"storage-analzyer": {
"install": "false",
"imageTag": "v1.18.8.0-06c5560-aliyun",
"imageRep": "acs/storage-analyzer",
"template": "/acs/templates/storage-analyzer/install.yaml"
},
"storage-auto-expander": {
"install": "false",
"imageTag": "v1.18.8.0-4852fd4-aliyun",
"imageRep": "acs/storage-auto-expander",
"crdTmpl": "/acs/templates/storage-auto-expander/crd.yaml",
"template": "/acs/templates/storage-auto-expander/install.yaml"
},
"storage-monitor": {
"install": "true",
"imageTag": "v1.18.8.0-c4744b6-aliyun",
"imageRep": "acs/storage-monitor",
"template": "/acs/templates/storage-monitor/install.yaml",
"svcTmpl": "/acs/templates/storage-monitor/service.yaml"
}
}
The following table describes the parameters in the default configurations.
Parameter | Description |
install | Specifies whether to deploy the component. Default value: |
imageTag | The default image version if the component is deployed. |
imageRep | The default image name if the component is deployed. |
crdTmpl | The template path of the Custom Resource Definition (CRD) that you want to deploy. If this parameter is empty, no CRD is deployed. |
svcTmpl | The template path of the Service that you want to deploy. |
template | The template path of the component that you want to deploy. |
You can use a ConfigMap to modify the parameters.
Method 2: Use a ConfigMap to customize the configurations
In this example, the following ConfigMap template is provided:
kind: ConfigMap
apiVersion: v1
metadata:
name: storage-operator
namespace: kube-system
data:
storage-snapshot-manager: |
# deploy config
install: false
imageTag: v1.16.aaaa
imageRep: acs/storage-snapshot-manager
template: /acs/templates/storage-snapshot-manager/install.yaml
# env config
SNAPSHOT_INTERVAL: 30
storage-analyzer: |
# deploy config
install: false
imageTag: v1.16.bbbb
imageRep: acs/storage-analyzer
template: /acs/templates/storage-analyzer/install.yaml
# env config
LOOP_INTERVAL: 30
storage-auto-expander: |
# deploy config
install: false
imageTag: v1.16.3adsadfs
imageRep: acs/storage-auto-expander
crdTmpl: /acs/templates/storage-auto-expander/crd.yaml
template: /acs/templates/storage-auto-expander/install.yaml
# env config
POLLING_INTERVAL_SECONDS: 60
Take note of the following items when you use custom configurations:
The parameter values that are specified in the custom configurations overwrite the parameter values in the default configurations.
The configurations of each component consist of two parts:
Deployment configurations, which are defined by the parameters in the deploy config section in the preceding example. The parameters specify whether to install the component and the component version that is deployed. storage-operator deploys and updates components based on these configurations.
Environment configurations, which are defined by the parameters in the env config section in the preceding example. The parameters are used by the storage component. For example,
SNAPSHOT_INTERVAL
is configured as an environment variable for the storage-snapshot-manager component.
The parameters used in deployment configurations are reserved parameters and cannot be used as environment variables.
You can customize specific parameters based on the features of a component.
Step 2: Deploy the storage-operator component
Run the following command to deploy storage-operator:
kubectl apply -f storage_operator.yaml
In this example, the following storage_operator.yaml file is used to deploy storage-operator:
apiVersion: apps/v1 kind: Deployment metadata: name: storage-operator namespace: kube-system labels: app: storage-operator spec: selector: matchLabels: app: storage-operator template: metadata: labels: app: storage-operator spec: tolerations: - operator: "Exists" priorityClassName: system-node-critical serviceAccount: storage-operator-admin containers: - name: storage-operator image: registry.cn-hangzhou.aliyuncs.com/acs/storage-operator:v1.18.8.28-18cca7b-aliyun imagePullPolicy: Always volumeMounts: - mountPath: /acs/configmap/ name: storage-operator restartPolicy: Always volumes: - configMap: name: storage-operator name: storage-operator
Run the following command to check whether storage-operator is running:
kubectl get pods -nkube-system | grep storage-operator
Expected output:
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES storage-operator-*** 1/1 Running 0 6d20h 192.168.XX.XX virtual-kubelet <none> <none>