YurtAppDaemon

    用户使用:

    • 创建test1节点池
    • 创建test2节点池
    1. apiVersion: apps.openyurt.io/v1alpha1
    2. kind: NodePool
    3. metadata:
    4. name: test2
    5. spec:
    6. selector:
    7. matchLabels:
    8. apps.openyurt.io/nodepool: test2
    9. type: Edge
    10. EOF
    • 将节点加入到节点池
    • 创建YurtAppDaemon
    1. cat <<EOF | kubectl apply -f -
    2. apiVersion: apps.openyurt.io/v1alpha1
    3. kind: YurtAppDaemon
    4. metadata:
    5. name: daemon-1
    6. namespace: default
    7. selector:
    8. matchLabels:
    9. workloadTemplate:
    10. deploymentTemplate:
    11. metadata:
    12. labels:
    13. app: daemon-1
    14. spec:
    15. replicas: 1
    16. selector:
    17. matchLabels:
    18. app: daemon-1
    19. template:
    20. metadata:
    21. labels:
    22. app: daemon-1
    23. spec:
    24. containers:
    25. - image: nginx:1.18.0
    26. imagePullPolicy: Always
    27. name: nginx
    28. nodepoolSelector:
    29. matchLabels:
    30. EOF
    • 为test1节点池打标签
    • 为test2节点池打标签
    1. kubectl label np test2 yurtappdaemon.openyurt.io/type=nginx
    2. # Check the Deployment
    3. kubectl get deployments.apps
    4. # Check the Deployment nodeselector
    5. # Check the Pod
    • 改变YurtAppDaemon
    • 移除节点池标签
    1. # Remove the nodepool test1 label
    2. kubectl label np test1 yurtappdaemon.openyurt.io/type-
    3. # Check the Deployment
    4. # Check the Pod
    5. # Remove the nodepool test2 label
    6. kubectl label np test2 yurtappdaemon.openyurt.io/type-
    7. # Check the Deployment