How to deploy at least one pod per minion while configuring replication controller?

0 votes

I've got 4 nodes with label role=nginx

master ~ # kubectl get node
NAME          LABELS                                          STATUS
10.1.141.34   kubernetes.io/hostname=10.1.141.34,role=nginx   Ready
10.1.141.40   kubernetes.io/hostname=10.1.141.40,role=nginx   Ready
10.1.141.42   kubernetes.io/hostname=10.1.141.42,role=nginx   Ready
10.1.141.43   kubernetes.io/hostname=10.1.141.43,role=nginx   Ready

I have configured the selector to look for role=nginx

spec:
  replicas: 4
  selector:
    role: nginx

But when I deploy the controller it deploys 2 pods on 2 different hosts. I want it to deploy one pod each on each of the nodes? Please Help!

Nov 23, 2018 in Kubernetes by Atul
• 10,240 points
43 views

1 answer to this question.

0 votes

I think what you actually want to deploy is a daemon set. It's made for this exact purpose, ensuring one daemon/pod running on each of the nodes you specify.

Use something like this:

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: nginxDaemon
  labels:
    role: nginx
spec:
  selector:
    matchLabels:
      role: nginx

for more information check: DaemonSets

answered Nov 23, 2018 by ajs3033
• 7,280 points

Related Questions In Kubernetes

0 votes
1 answer
0 votes
1 answer

how to debug a pending pod?

Pending pod cannot be scheduled onto a ...READ MORE

answered Jul 15 in Kubernetes by Sirajul
• 25,180 points
23 views
0 votes
1 answer

How do i tie a service to a pod or a set of pods?

By declaring pods with the label(s) and ...READ MORE

answered Jul 16 in Kubernetes by Sirajul
• 25,180 points
31 views
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17 in Others by anonymous
2,047 views
+3 votes
1 answer
0 votes
1 answer

How to use gravitational teleport in a container/kubernetes environment?

You can use teleport to augment kubernetes ...READ MORE

answered Jun 28, 2018 in Kubernetes by ajs3033
• 7,280 points
315 views
0 votes
2 answers