pod選擇node節(jié)點(diǎn)

1. node節(jié)點(diǎn)label管理

1.1 給節(jié)點(diǎn)加label

  • 語法:
    # kubectl label node Node_Name Key=Value
  • 示例
# kubectl label node gpu3 gpu-use=true

1.2 查看label

  • 語法
    Kubectl get node gpu3 --show-labels
image.png

1.3 修改label

  • 語法
    kubectl label node Node_Name Key=Value --overwrite

說明:添加label命令加上 --overwrite參數(shù)

  • 示例
 kubectl label node gpu3 gpu-use=true --overwrite

1.4 刪除lable

  • 語法
    kubectl label node Node_Name Key-

說明:刪除一個key,只需把key的后邊加一個減號即可

  • 示例
# kubectl label node gpu3 gpu_use-

2 pod選擇node節(jié)點(diǎn)

說明:pod根據(jù)node的label選擇節(jié)點(diǎn)

apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: nvidia-device-plugin-daemonset
  namespace: kube-system
spec:
  template:
    metadata:
      annotations:
        scheduler.alpha.kubernetes.io/critical-pod: ""
      labels:
        name: nvidia-device-plugin-ds
    spec:
      tolerations:
      - key: CriticalAddonsOnly
        operator: Exists
     #添加如下兩行
      nodeSelector:
        gpu-use: "true"
      containers:
      - image: nvidia/k8s-device-plugin:1.11
        name: nvidia-device-plugin-ctr
        securityContext:
          capabilities:
            drop: ["ALL"]
        volumeMounts:
          - name: device-plugin
            mountPath: /var/lib/kubelet/device-plugins
      volumes:
        - name: device-plugin
          hostPath:
            path: /var/lib/kubelet/device-plugins

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • pod資源標(biāo)簽使用技巧 在k8s之上,每一種資源都可以有一個標(biāo)簽,現(xiàn)實(shí)中用到的pod數(shù)量可能越來越多,我們期望能夠...
    菜頭_355f閱讀 566評論 0 3
  • 1 標(biāo)簽 1.1 為什么要有標(biāo)簽? ??在微服務(wù)架構(gòu)中,部署的微服務(wù)數(shù)量很容器達(dá)到幾十個,這些組件可能是副本(部署...
    Hughman閱讀 612評論 0 0
  • 控制器管理的 Pod: 生產(chǎn)環(huán)境中可以用控制器創(chuàng)建和管理多個 pod??刂破髟?pod 失敗的情況下可以處理副本、...
    菜頭_355f閱讀 868評論 0 1
  • 一、 K8s 是什么? Kubernetes(k8s)是自動化容器操作的開源平臺,這些操作包括部署,調(diào)度和節(jié)點(diǎn)集群...
    loveroot閱讀 6,716評論 1 21
  • kubectl explain pods #詳細(xì)POD參數(shù) vi pod-demo.yaml apiVersion...
    仙凡閱讀 459評論 0 0

友情鏈接更多精彩內(nèi)容