Kubernetes assign pods to pool

PlagTag picture PlagTag · Oct 20, 2016 · Viewed 7.7k times · Source

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

Answer

PlagTag picture PlagTag · Oct 20, 2016

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