首页 > 其他分享 >deploy资源-配置节点亲和性以及污点容忍

deploy资源-配置节点亲和性以及污点容忍

时间:2023-03-03 15:14:36浏览次数:46  
标签:Exists name kubernetes deploy 亲和性 operator master key 污点

apiVersion: apps/v1
kind: Deployment
metadata:
  name: health-check-deployment
  labels:
    app: health-check
spec:
  replicas: 1
  selector:
    matchLabels:
      app: health-check
  template:
    metadata:
      labels:
        app: health-check
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: node-role.kubernetes.io/master
                operator: Exists
      tolerations:
      - key: node-role.kubernetes.io/master
        operator: Exists
        effect: NoSchedule
      - key: node.kubernetes.io/unschedulable
        operator: Exists
        effect: NoSchedule
      containers:
      - name: check-status
        image: hub-pub.jdcloud.com/jdos/jdos-k8s-jiankong:v1.0.0-4b9258e
        imagePullPolicy: IfNotPresent
        #command: ["bash","-c","/root/health-chek/check-k8s.sh   && sleep 100000"]
        volumeMounts:
        - mountPath: /root/.kube/config
          name: kubeconfig
        - mountPath: /usr/bin/kubectl
          name: kubectl-procedure
        - mountPath: /usr/bin/etcdctl
          name: etcdctl-procedure
        - mountPath: /etc/ssl/etcd/ssl/
          name: etcd-certs-dir
      volumes:
      - name: kubeconfig
        hostPath:
          path: /etc/kubernetes/admin.conf
          type: File
      - name: kubectl-procedure
        hostPath:
          path: /usr/local/bin/kubectl
          type: File
      - name: etcdctl-procedure
        hostPath:
          path: /usr/local/bin/etcdctl
          type: File
      - name: etcd-certs-dir
        hostPath:
          path: /etc/ssl/etcd/ssl/
          type: Directory

  

备注:1. affinity:

        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: node-role.kubernetes.io/master
                operator: Exists
配置节点亲和性,requiredDuringSchedulingIgnoredDuringExecution 代表强制调度,调度pod到已存在的master role的节点(也就是master节点)

2. 污点容忍
      - key: node-role.kubernetes.io/master
        operator: Exists
        effect: NoSchedule
      - key: node.kubernetes.io/unschedulable
        operator: Exists
        effect: NoSchedule
容忍不可调度污点,以及master不可调度污点

标签:Exists,name,kubernetes,deploy,亲和性,operator,master,key,污点
From: https://www.cnblogs.com/gsda/p/17175677.html

相关文章

  • 4大特性,带你认识化繁为简的华为云CodeArts Deploy
    摘要:2月27日,华为云发布持续部署服务CodeArtsDeploy,通过模块化自由编排部署流程,实现软件的自动化部署,帮助企业软件产品的快速、高效、高质量交付。本文分享自华为云社区《......
  • k8sdeploy配置文件示例
    apiVersion:extensions/v1beta1kind:Deploymentmetadata:name:[k8s服务名]namespace:defaultlabels:k8s-app:[k8s服务名]spec:replicas:1te......
  • K8S污点容忍案例
    [root@lecode-pre74~]#setenforce0setenforce:SELinuxisdisabled[root@lecode-pre74~]#sed-i's/SELINUX=enforcing/SELINUX=disabled/'/etc/selinux/config[......
  • Odoo Deployment Expert.
    OdooDeploymentExpert.  roadyoung请假设你是odoo部署专家,应用及开发工程师。 好的,作为Odoo部署专家、应用及开发工程师,我可以提供以下服务: Odoo部署:我可以帮助客......
  • k8s-deployment扩缩容
    目录手动扩缩容手动扩缩容1.kubectlscaledeploynginx--replicas=3#非交互2.kubectleditdeploynginx#交互式......
  • k8s-deployment回滚
    更新yaml文件镜像版本--模拟更新版本1.kubectlsetimagedeploynginxnginx=nginx:1.14.2--record#非交互2.kubectleditdeploynginx#交互式更改查看历史版......
  • Deployment
    Deployment部署(Deployment)是k8s中常用的资源之一,部署是无状态的,为一般性项目应用的主体,我们可以像声明docker-compose.yaml文件一样去定义容器的属性。内容介绍:Deployme......
  • Istio从入门到精通——Istio Deployment Models
    IstioDeploymentModelshttps://istio.io/latest/docs/ops/deployment/deployment-models/ WhenconfiguringaproductiondeploymentofIstio,youneedtoanswer......
  • Vercel deploy environment variables All In One
    VerceldeployenvironmentvariablesAllInOne.envfilevsENV_API_KEYvariables(......
  • Kubernetes(k8s)控制器(一):deployment
    目录一.系统环境二.前言三.Kubernetes控制器四.Deployment概览五.创建deployment六.修改deploy副本数6.1kubectleditdeploy修改副本数6.2修改yaml文件更改副本数6.3......