1 概要介绍
DaemonSet:
特点:
确保全部Node上运行一个Pod副本(单副本)
Node加入集群,则新增Pod;移除,则回收
删除Daemonset,删除创建的Pod
2编写
2.1 必须字段
apiVersion:
可用值: extensions/v1beta1
kind :
可用值:DaemonSet
metadata:
例如:name: nova-compute
.spec:
唯一必须的字段:
.spec.template
例如:
metadata:
labels:
{
{ tuple $envAll .Chart.Name $daemonset | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
annotations:
configmap-bin-hash: {
{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
.spec.template:
含义:是Pod模板。Pod有明确的格式。Pod中必须指明标签合重启策略,默认always。
具体参见:
https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#pod-template
2.2 Pod Selector
.spec.selector:
表示Pod Selector.是对象,包含:
matchLabels:
matchEx[ressions:
终于发现不能运行的原因:
zabbix-damonset:
{
{ tuple $envAll "zabbix_agent" | include "helm-toolkit.snippets.kubernetes_upgrades_daemonset" | indent 2 }}
nova-daemonset:
{
{ tuple $envAll $daemonset | include "helm-toolkit.snippets.kubernetes_upgrades_daemonset" | indent 2 }}
ceilometer现在写的是:
{
{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }}
如果指定spec.selector必须和.spec.template.metadata.labels
匹配,目前没有发现spec.selector
2.3 .spec.template.spec.nodeSelector
如果指定.spec.template.spec.nodeSelector,则Daemonset Controller将在能够匹配上Node Selector的Node上创建Pod,在能够匹配上的Node Affinity的N