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,250 points
63 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, 2019 in Kubernetes by Sirajul
• 45,960 points
134 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, 2019 in Kubernetes by Sirajul
• 45,960 points
65 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, 2019 in Others by anonymous
4,314 views
+3 votes
1 answer

Installing Web UI (Dashboard):kubernetes-dashboard on main Ubuntu 16.04.6 LTS (Xenial Xerus) server

Follow these steps: $ kubeadm reset $ kubeadm init ...READ MORE

answered Apr 11, 2019 in Kubernetes by Kalgi
• 50,840 points

reshown Apr 12, 2019 by Kalgi 1,165 views
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
492 views
0 votes
2 answers

Using a local image to create a pod in K8s

I'm not sure but you can try ...READ MORE

answered Apr 29, 2019 in Kubernetes by Vishaka
7,468 views