k8s部署pod到指定的节点上

2019-10-24  本文已影响0人  天冷请穿衣

2019-10-24
1、给节点打标签
kubectl label nodes k8snode-03 slave=3
2、部署时指定标签

apiVersion: apps/v1
kind: StatefulSet
metadata:
name: test
spec:
serviceName: "test"
replicas: 2
selector:
  matchLabels:
    app: test
template:
  metadata:
    labels:
      app: test
  spec:
    containers:
      - name: test
        imagePullPolicy: IfNotPresent
        image: registry/test-image:1.0.1
    nodeSelector:
      slave: "3"

参考:https://www.iteye.com/blog/m635674608-2360874

上一篇下一篇

猜你喜欢

热点阅读