A DaemonSet ensures that all or some nodes run a pod instance. It dynamically adds instances to new nodes. You can create a DaemonSet using a YAML file. After a DaemonSet is created, you can monitor, delete, or perform other operations on it.
DaemonSets are a native Kubernetes concept. For more information, see the official Kubernetes documentation.
Create a DaemonSet
This section describes how to create a DaemonSet using a YAML file.
Procedure
Log on to the SOFASTACK console.
In the navigation pane on the left, click Container Application Service > Workloads > DaemonSets.
On the DaemonSets page, click Create from YAML.
In the input box, enter the YAML content and click Submit.
The following is an example:
kind: DaemonSet metadata: name: daemonset-example labels: k8s-app: daemonset-example namespace: yournamespace # Change this to your current namespace name spec: selector: matchLabels: k8s-app: daemonset-example template: metadata: labels: k8s-app: daemonset-example spec: containers: - name: nginx image: reg-cnsh.cloud.alipay.com/library/nginx:latest
After the DaemonSet is created, its status is displayed as Running.
Update a DaemonSet
This section describes how to update a DaemonSet by modifying its YAML file.
Prerequisites
The YAML file has been created.
Procedure
Log on to the SOFASTACK console.
In the navigation pane on the left, click Container Application Service > Workloads > DaemonSets.
On the Daemonsets page, click View/Edit YAML.
In the YAML editor, modify the configuration and click Update.
After the update is successful, the system automatically deploys the DaemonSet based on the new YAML file.
Delete a DaemonSet
This section describes how to delete a DaemonSet.
Prerequisites
The YAML file is generated.
Procedure
Log on to the SOFASTACK console.
In the navigation pane on the left, click Container Application Service > Workloads > DaemonSets.
On the DaemonSets page, find the DaemonSet that you want to delete and click Delete in the Actions column. In the dialog box that appears, click OK.
Monitor a DaemonSet
This section describes how to monitor a DaemonSet.
Prerequisites
The YAML file has been created.
Procedure
Log on to the SOFASTACK console.
In the navigation pane on the left, click Container Application Service > Workloads > DaemonSets.
On the DaemonSets page, find the DaemonSet that you want to monitor and click Monitor in the Actions column. You are redirected to the Cloud Monitor console, where you can view the monitoring metrics of the DaemonSet.
For more information about operations in the Cloud Monitor console, see View application groups.