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
84 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

How to deploy Jenkins pod in minikube?

Hi@akhtar, In minikube you don't have to download ...READ MORE

answered May 19 in Kubernetes by MD
• 31,430 points
87 views
0 votes
1 answer

How to launch one Pod in a particular namespace in minikube?

Hi@akhtar, You can pass your namespace name when ...READ MORE

answered 4 days ago in Kubernetes by MD
• 31,430 points
13 views
0 votes
1 answer
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
7,050 views
+4 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
• 51,890 points

reshown Apr 12, 2019 by Kalgi 2,083 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
767 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
12,971 views