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
577 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,300 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, 2020 in Kubernetes by MD
• 95,440 points
1,716 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 Jun 30, 2020 in Kubernetes by MD
• 95,440 points
737 views
0 votes
1 answer

How to deploy the pod in k8s connect to 3rd party server which using whitelist IP?

Hey, You can connect the pod and the ...READ MORE

answered Oct 29, 2020 in Kubernetes by Sam

edited Oct 6, 2021 by Sarfaraz 1,014 views
+1 vote
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
14,587 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 12, 2019 in Kubernetes by Kalgi
• 52,360 points

reshown Apr 12, 2019 by Kalgi 6,070 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,300 points
2,226 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
19,291 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP