zoukankan      html  css  js  c++  java
  • Kubernetes 调度器

    指定调度节点

    1、Pod.spec.nodeName 将 Pod 直接调度到指定的 Node 节点上,会跳过 Scheduler 的调度策略,该匹配规则是强制匹配

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: myapp-pod6
    spec:
      selector:
        matchLabels:
          app: myapp-pod6
      replicas: 4
      template:
        metadata:
          labels:
            app: myapp-pod6
        spec:
          nodeName: xgcloud-ops-k8s-cluster-1.novalocal
          containers:
          - name: myapp-pod6
            image: busybox
            command: ['sh', '-c', 'echo Hello Kubernetes! && sleep 3600']

    kubectl apply -f pod6.yaml 

    kubectl get pod -o wide

    2、Pod.spec.nodeSelector:通过 kubernetes 的 label-selector 机制选择节点,由调度器调度策略匹配 label,而后调度 Pod 到目标节点,该匹配规则属于强制约束

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: myapp-pod7
    spec:
      selector:
        matchLabels:
          app: myapp-pod7
      replicas: 4
      template:
        metadata:
          labels:
            app: myapp-pod7
        spec:
          nodeSelector:
            kubernetes.io/hostname: xgcloud-ops-k8s-cluster-2.novalocal 
          containers:
          - name: myapp-pod7
            image: busybox
            command: ['sh', '-c', 'echo Hello Kubernetes! && sleep 3600']

    kubectl apply -f pod7.yaml 

    kubectl get pod -o wide

  • 相关阅读:
    事件回顾
    把时间花在经典上
    事件回顾
    硬件毛刺
    事件回顾
    cache支持三种pre-fetch方式:normal/pre-fetch1/pre-fetch2-way1/pre-fetch-way2
    cache支持single/increment/increment4三种方式传输
    计算机必读书籍
    那些让我们如此享受的慢性毒药(转载)
    平淡节制
  • 原文地址:https://www.cnblogs.com/litzhiai/p/14978624.html
Copyright © 2011-2022 走看看