我正在EKS中运行Kubernetes集群,但是由于某些原因,并不总是遵循部署上的nodeSelector属性。
三个部署: 1-卡珊德拉:
kind: StatefulSet
metadata:
name: cassandra
labels:
app: cassandra
spec:
serviceName: cassandra
replicas: 3
...
spec:
terminationGracePeriodSeconds: 1800
containers:
- name: cassandra
image: gcr.io/google-samples/cassandra:v13
...
nodeSelector:
layer: "backend"
2-卡夫卡
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
service: kafka
...
spec:
containers:
image: strimzi/kafka:0.11.3-kafka-2.1.0
...
nodeSelector:
layer: "backend"
...
3-Zookeeper
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
service: zookeeper
...
spec:
containers:
image: strimzi/kafka:0.11.3-kafka-2.1.0
...
nodeSelector:
layer: "backend"
...
注意-所有三个容器规范上都有nodeSelector“ layer = backend”。我只有2个“后端”广告连播,但是当我看到广告连播时,就会看到:
% kubectl get all -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
pod/cassandra-0 1/1 Running 0 9m32s 10.1.150.39 ip-...-27.us-west-2.compute.internal <none> <none>
pod/cassandra-1 1/1 Running 0 7m56s 10.1.100.7 ip-...-252.us-west-2.compute.internal <none> <none>
pod/cassandra-2 1/1 Running 0 6m46s 10.1.150.254 ip-...-27.us-west-2.compute.internal <none> <none>
pod/kafka-56dcd8665d-hfvz4 1/1 Running 0 9m32s 10.1.100.247 ip-...-252.us-west-2.compute.internal <none> <none>
pod/zookeeper-7f74f96f56-xwjjt 1/1 Running 0 9m32s 10.1.100.128 ip-...-154.us-west-2.compute.internal <none> <none>
它们被放置在三个不同的节点上-27、252和154。查看每个节点上的“层”标签:
> kubectl describe node ip-...-27.us-west-2.compute.internal | grep layer
layer=backend
> kubectl describe node ip-...-252.us-west-2.compute.internal | grep layer
layer=backend
> kubectl describe node ip-...-154.us-west-2.compute.internal | grep layer
layer=perf
154节点的标签为“ perf”,而不是“后端”。因此,根据我对nodeSelector的了解,不应将zookeeper吊舱放在那里。我删除了所有内容(包括节点本身),并尝试了几次-有时是将kafka放到那里,有时是zookeeper,但确实有东西放到了不应该的地方。
据我所知,我确实想要的节点有足够的容量,即使没有,我也会想到这样一个错误:无法调度Pod,而不是忽略nodeSelector。
我想念什么? nodeSelector不是100%可靠吗?还有另一种方法可以强制将吊舱仅放置在带有特定标签的节点上吗?
答案 0 :(得分:1)
由于用户错误而关闭。
一个单独的过程恢复了我的git更改,并且我在IDE中查看的部署已过时。