stupidusername opened a new issue #5380: Kubernetes deployment: Pods from a 
service are being scheduled on the same node
URL: https://github.com/apache/pulsar/issues/5380
 
 
   I 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` 
   
   ```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](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#an-example-of-a-pod-that-uses-pod-affinity)
 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!

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to