Configuring a ClusterExtensionProfile or ExtensionProfile
You can configure ClusterExtensionProfile or ExtensionProfile objects to schedule workloads to CCI 2.0. ClusterExtensionProfiles are a cluster-level object, and ExtensionProfiles are of the namespace level. They can be used to configure pods scheduled to CCI 2.0 to reduce the modification to YAML files.
Configuring a ClusterExtensionProfile
- Generate a YAML file.
The following is an example YAML file:
apiVersion: bursting.cci.io/v1 kind: ClusterExtensionProfile metadata: name: test-cluster-profile spec: actions: annotations: annotation1: value1 hostPathReplacement: - emptyDir: sizeLimit: 10Gi name: volume1 policyType: replaceByEmptyDir labels: label1: value1 namespaceLabels: matchLabels: key2: value2 policy: override
- Create the object.
kubectl apply -f <test-cluster-profile> #YAML file name (Replace it with the actual file name.)
- (Optional) Verify that the object has been created.
kubectl get cextp
Configuring an ExtensionProfile
- Generate a YAML file.
The following is an example YAML file:
apiVersion: bursting.cci.io/v1 kind: ExtensionProfile metadata: name: test-profile spec: actions: annotations: annotation1: value1 hostPathReplacement: - emptyDir: sizeLimit: 10Gi name: volume1 policyType: replaceByEmptyDir labels: label1: value1 namespaceLabels: matchLabels: key2: value2 policy: override
- Create the object.
kubectl apply -f <test-profile> #YAML file name (Replace it with the actual file name.)
- (Optional) Verify that the object has been created.
kubectl get extp
spec Parameters
Parameter |
Description |
---|---|
policy |
Indicates the policy to be configured. The value can be addOnly or override. When a configuration conflicts with the original definition of a pod, setting the parameter of the configuration to override will overwrite the original definition, but setting it to addOnly will not. The default value is addOnly. |
namespaceLabels |
Filters namespaces by namespace label. |
objectLabels |
Filters pods by pod label.
CAUTION:
For details about matchLabels and matchExpressions, see Kubernetes official documentation. |
actions Parameters
Parameter |
Description |
---|---|
annotations |
Adds annotations to a pod. |
labels |
Adds labels to a pod. |
imageReplacement |
Adds an image path conversion policy to a pod. |
hostPathReplacement |
Adds a hostPath volume conversion policy to a pod. |
evictions |
Configures the pod eviction policy in case of disk pressure. |
podSidecars |
Adds a sidecar to a pod. |
Rules for an Effective Profile
- The configuration only takes effect for new pods when they are created. The existing pods are not modified.
- Only one ClusterExtensionProfile and one ExtensionProfile can take effect for a pod. If both types of profiles are matched, the ClusterExtensionProfile takes the precedence.
- If the label of the namespace where the pod is located can be matched by multiple ClusterExtensionProfiles, only the most exactly matched profile takes effect.
- If the label of a pod can be matched by multiple ExtensionProfiles, only the most exactly matched profile takes effect.
- Definition of the most exactly matched profile:
- The larger the sum of the values of all matchLabels and matchExpressions in objectLabels or namespaceLabels, the more accurate the profile is.
- If the number of profiles is the same, the profile whose name has the smallest alphabetical order is used.
Pod Eviction After Disk Pressure
If image snapshots are not used and the disk space of a node is less than 100 MiB, a condition of NodeFsDiskPressure is reported for the pod. If image snapshots are used and the temporary disk space of a node is less than 100 MiB or the disk space of the container image is less than 100 MiB, a condition of NodeFsDiskPressure or ImageFsDiskPressure is reported. When the temporary disk space of a node or the disk space of the container image is greater than 100 MiB, the corresponding condition is removed.
In either scenarios where the disk space is insufficient, the system does not perform any operation by default, which may affect the workloads. Based on the Kubernetes eviction and scheduling mechanism, you can configure eviction policies for specified ClusterExtensionProfiles or ExtensionProfiles to automatically evict pods.
Most workloads are Deployments. If a pod is evicted from a Deployment, a new pod is automatically created for the Deployment.
actions: evictions: - type: "Hard" signal: "DiskPressure"
- Method 1: Use a ClusterExtensionProfile to configure an eviction policy for a pod with a specified namespace label.
apiVersion: bursting.cci.io/v1 kind: ClusterExtensionProfile metadata: name: eviction-cluster-profile spec: actions: evictions: - type: "Hard" signal: "DiskPressure" namespaceLabels: matchLabels: key: value
- Method 2: Use an ExtensionProfile to configure an eviction policy for a pod with a specified namespace label.
apiVersion: bursting.cci.io/v1 kind: ExtensionProfile metadata: name: eviction-cluster-profile namespace: default spec: actions: evictions: - type: "Hard" signal: "DiskPressure" objectLabels: matchExpressions: - key: key2 operator: In values: - v2 - v3 - key: key3 operator: Exists matchLabels: key1: value1 policy: addOnly
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot