Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DaemonSets on Google Container Engine (Kubernetes)

I have a Google Container Engine cluster with 21 nodes, there is one pod in particular that I need to always be running on a node with a static IP address (for outbound purposes).

Kubernetes supports DaemonSets

This is a way to have a pod be deployed to a specific node (or in a set of nodes) by giving the node a label that matches the nodeSelector in the DaemonSet. You can then assign a static IP to the VM instance that the labeled node is on. However, GKE doesn't appear to support the DaemonSet kind.

$ kubectl create -f go-daemonset.json 
error validating "go-daemonset.json": error validating data: the server could not find the requested resource; if you choose to ignore these errors, turn validation off with --validate=false

$ kubectl create -f go-daemonset.json --validate=false
unable to recognize "go-daemonset.json": no kind named "DaemonSet" is registered in versions ["" "v1"]

When will this functionality be supported and what are the workarounds?

like image 319
Michael Avatar asked Feb 19 '16 19:02

Michael


People also ask

What are DaemonSets in Kubernetes?

DaemonSets are useful for deploying ongoing background tasks that you need to run on all or certain nodes, and which do not require user intervention. Examples of such tasks include storage daemons like ceph , log collection daemons like fluent-bit , and node monitoring daemons like collectd .

Which container orchestration tool does Google Kubernetes engine use?

GKE supports the use of container images that are built with Docker, for example as part of a build and deploy pipeline. In GKE version 1.24 and later, Docker cannot manage the lifecycle of containers running on GKE nodes. To learn more about the node images that GKE supports for your workloads, see Node images.


1 Answers

If you only want to run the pod on a single node, you actually don't want to use a DaemonSet. DaemonSets are designed for running a pod on every node, not a single specific node.

To run a pod on a specific node, you can use a nodeSelector in the pod specification, as documented in the Node Selection example in the docs.


edit: But for anyone reading this that does want to run something on every node in GKE, there are two things I can say:

First, DaemonSet will be enabled in GKE in version 1.2, which is planned for March. It isn't enabled in GKE in version 1.1 because it wasn't considered stable enough at the time 1.1 was cut.

Second, if you want to run something on every node before 1.2 is out, we recommend creating a replication controller with a number of replicas greater than your number of nodes and asking for a hostPort in the container spec. The hostPort will ensure that no more than one pod from the RC will be run per node.

like image 51
Alex Robinson Avatar answered Oct 18 '22 05:10

Alex Robinson