Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes assign pods to pool

Tags:

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 
like image 749
PlagTag Avatar asked Oct 20 '16 12:10

PlagTag


People also ask

How do you assign a pod to a specific node in the Kubernetes cluster?

You can add the nodeSelector field to your Pod specification and specify the node labels you want the target node to have. Kubernetes only schedules the Pod onto nodes that have each of the labels you specify. See Assign Pods to Nodes for more information.

How do you move pods from one node to another Kubernetes?

First of all you cannot “move” a pod from one node to another. You can only delete it from one node and have it re-created on another. To delete use the kubectl delete command. To ensure a pod lands on a specific node using node affinity/taints and tolerations.

Can a pod run on multiple nodes?

A Node can have multiple pods, and the Kubernetes control plane automatically handles scheduling the pods across the Nodes in the cluster. The control plane's automatic scheduling takes into account the available resources on each Node.


1 Answers

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 
like image 89
PlagTag Avatar answered Oct 06 '22 01:10

PlagTag