Kubernetes deployment: Pods from a service are being scheduled on the same node
See original GitHub issueI was trying to deploy pulsar using GKE. While I was deploying the ZooKeeper service I noticed that its pods were being scheduled on the same node. I am really new to Kubernetes but this looks a little odd to me:
deployment/kubernetes/google-kubernetes-engine/zookeeper.yaml
spec:
serviceName: zookeeper
replicas: 3
template:
metadata:
labels:
app: pulsar
component: zookeeper
cluster: pulsar-gke
annotations:
pod.alpha.kubernetes.io/initialized: "true"
prometheus.io/scrape: "true"
prometheus.io/port: "8080"
spec:
# Make sure multiple pods of ZK don't get scheduled on the
# same node, unless there are no other available nodes
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
podAffinityTerm:
labelSelector:
matchExpressions:
- key: "app"
operator: In
values:
- zookeeper
topologyKey: "kubernetes.io/hostname"
I read this Kubernetes affinity example and I think that the key
used in matchExpressions
should be component
, not app
. When I use component
as the key
, all the ZooKeeper pods are scheduled on different nodes.
If I am correct, this error is present in all the Kubernetes deployment files.
Is there any Kubernetes expert willing to take a look at this?
Thank you!
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Assigning Pods to Nodes - Kubernetes
Node affinity is conceptually similar to nodeSelector , allowing you to constrain which nodes your Pod can be scheduled on based on node ......
Read more >Advanced Kubernetes pod to node scheduling
In Kubernetes, the task of scheduling pods to specific nodes in the cluster is handled by the kube-scheduler. The default behavior of this ......
Read more >Kubernetes: How to deploy different pods close to each other ...
You need to make sure that no more than one pod is scheduled on a node to make sure your pods are as...
Read more >Avoiding kubernetes scheduler to run all pods in single node ...
The podAntiAfinity with requiredDuringSchedulingIgnoredDuringExecution can be used to prevent the same pod from being scheduled to the same ...
Read more >How To Avoid Placement of More Than One Pod Replicas on ...
How to configure deployment to avoid co-location of replicas on a single node? Environment. Platform9 Managed Kubernetes - All Versions; Kube-Scheduler ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@cdbartholomew Thanks for submitting the PR!
they put
component
in this one here