Search code examples
kubernetesgcloudkubectl

Kubernetes assign pods to pool


is there a way to tell kubectl that my pods should only deployed on a certain instance pool?

For example:

nodeSelector:
      pool: poolname

Assumed i created already my pool with something like:

gcloud container node-pools create poolname --cluster=cluster-1 --num-nodes=10 --machine-type=n1-highmem-32

Solution

  • Ok, i found out a solution:

    gcloud creates a label for the pool name. In my manifest i just dropped that under the node selector. Very easy.

    Here comes my manifest.yaml: i deploy ipyparallel with kubernetes

    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      name: ipengine
    spec:
      replicas: 1
      template:
        metadata:
          labels:
            app: ipengine
        spec:
          containers:
          - name: ipengine
            image: <imageaddr.>
            args:
            - ipengine
            - --ipython-dir=/tmp/config/
            - --location=ipcontroller.default.svc.cluster.local
            - --log-level=0
            resources:
              requests:
                cpu: 1
                #memory: 3Gi
          nodeSelector:
            #<labelname>:value
            cloud.google.com/gke-nodepool: pool-highcpu32