One - One Code All

Blog Content

k8s将pod运行到指定的节点上,给节点打标签

容器化 运维   2020-07-28 23:29:22

给节点打上标签:

在创建pod的yaml文件时:  添加 nodeSelector

# 查看当前集群节点标签信息
kubectl get nodes --show-labels

kubectl label node   GPU=true   #打上标签 GPU=true

kubectl label nodes node4 deploy.type=assembly_app

apiVersion: apps/v1
kind: Pod
metadata:
  name: nginx-pod
  namespace: my-namespace
  labels:
    app: nginx-pod
spec:
     nodeSelector:
       deploy.type: assembly_app
     restartPolicy: Always
     containers:
     - name: nginx
       image: "nginx"
       ports:
        - containerPort: 80

上一篇:docker-compose.yml中配置docker执行命令
下一篇:alpine镜像中lrzsz的安装

The minute you think of giving up, think of the reason why you held on so long.