I'm trying to simulate Daemon-set in kubernetes with using Deployment/RC/Replica-set.
What I want to achieve :
As daemon-set kind deploy PODs on each nodes like wise I want to deploy pod on each node, but without kind daemonset.
Is there any way to do it ? Can't find proper way to do that.
You can do that by using Deployment/ReplicaSet in Kubernetes with hostPort.
Assuming you have 4 nodes in Kubernetes cluster, you can create a deployment or replicaset with hostPort and replicas equal to number of nodes in cluster.
For example you want to run nginx pod on every node with clustersize equal to 4 then you have mention hostport to container port in deployment/replicaset definition. The kubernetes scheduler will be unable to schedule more than 1 pod on same host and in this way all nodes have at least one pod scheduled.
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx-hello
labels:
tier: frontend
app: nginx-hello
spec:
replicas: 4
template:
metadata:
labels:
tier: frontend
app: nginx-hello
spec:
containers:
- name: nginx-hello
image: nginxdemos/hello
ports:
- containerPort: 80
hostPort: 8088
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With