How to ensure only one pod runs on my node in GKE? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experience Should we burninate the [wrap] tag?Allow only one pod of a type on a node in KubernetesNode not ready, pods pendingAutomatically apply Kubernetes taint in Google CloudHow to force Pods/Deployments to Master nodes?Kubernetes: how to change accessModes of auto scaled pod to ReadOnlyMany?Kubernetes Horizontal Pod Autoscaler not utilising node resourcesKubernetes cluster in Google (GKE) is over scaling nodesCan I use local SSDs on GKE for fast, temporary storage within a pod?Do init containers run on the same node as their app container in GKEHow to prevent pods scheduling to a node after a pod has failed on it, in GCE?
iPhone Wallpaper?
When -s is used with third person singular. What's its use in this context?
Right-skewed distribution with mean equals to mode?
Using et al. for a last / senior author rather than for a first author
"Seemed to had" is it correct?
Bonus calculation: Am I making a mountain out of a molehill?
Letter Boxed validator
Storing hydrofluoric acid before the invention of plastics
If Jon Snow became King of the Seven Kingdoms what would his regnal number be?
3 doors, three guards, one stone
When to stop saving and start investing?
Output the ŋarâþ crîþ alphabet song without using (m)any letters
I need to find the potential function of a vector field.
What are the motives behind Cersei's orders given to Bronn?
Can a non-EU citizen traveling with me come with me through the EU passport line?
Why is "Consequences inflicted." not a sentence?
Why are there no cargo aircraft with "flying wing" design?
If a contract sometimes uses the wrong name, is it still valid?
How to deal with a team lead who never gives me credit?
What would be the ideal power source for a cybernetic eye?
How much radiation do nuclear physics experiments expose researchers to nowadays?
Should I call the interviewer directly, if HR aren't responding?
What does '1 unit of lemon juice' mean in a grandma's drink recipe?
do i need a schengen visa for a direct flight to amsterdam?
How to ensure only one pod runs on my node in GKE?
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experience
Should we burninate the [wrap] tag?Allow only one pod of a type on a node in KubernetesNode not ready, pods pendingAutomatically apply Kubernetes taint in Google CloudHow to force Pods/Deployments to Master nodes?Kubernetes: how to change accessModes of auto scaled pod to ReadOnlyMany?Kubernetes Horizontal Pod Autoscaler not utilising node resourcesKubernetes cluster in Google (GKE) is over scaling nodesCan I use local SSDs on GKE for fast, temporary storage within a pod?Do init containers run on the same node as their app container in GKEHow to prevent pods scheduling to a node after a pod has failed on it, in GCE?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
In my application, I have a rest server which locally interacts with a database via the command line (it's a long story). Anyway, the database is mounted in a local ssd on the node. I can guarantee that only pods of that type will by scheduled in the node pool, as I have tainted the nodes and added tolerances to my pods.
What I want to know is, how can I prevent kubernetes from scheduling multiple instances of my pod on a single node? I want to avoid this as I want my pod to be able to consume as much CPU as possible, and I also don't want multiple pods to interact via the local ssd.
How do I prevent scheduling of more than one pod of my type onto the node? I was thinking daemon sets at first, but I think down the line, I want to set my node pool to auto scale, that way when I have n nodes in my pool, and I request n+1 replicas, the node pool automatically scales up.
kubernetes google-container-engine
add a comment |
In my application, I have a rest server which locally interacts with a database via the command line (it's a long story). Anyway, the database is mounted in a local ssd on the node. I can guarantee that only pods of that type will by scheduled in the node pool, as I have tainted the nodes and added tolerances to my pods.
What I want to know is, how can I prevent kubernetes from scheduling multiple instances of my pod on a single node? I want to avoid this as I want my pod to be able to consume as much CPU as possible, and I also don't want multiple pods to interact via the local ssd.
How do I prevent scheduling of more than one pod of my type onto the node? I was thinking daemon sets at first, but I think down the line, I want to set my node pool to auto scale, that way when I have n nodes in my pool, and I request n+1 replicas, the node pool automatically scales up.
kubernetes google-container-engine
1
I think you just create a daemonset and setup node scaling independent of this. when a new node is added , a pod will be automatically run on that. I see that a cleaner way
– Ijaz Ahmad Khan
Mar 9 at 11:02
add a comment |
In my application, I have a rest server which locally interacts with a database via the command line (it's a long story). Anyway, the database is mounted in a local ssd on the node. I can guarantee that only pods of that type will by scheduled in the node pool, as I have tainted the nodes and added tolerances to my pods.
What I want to know is, how can I prevent kubernetes from scheduling multiple instances of my pod on a single node? I want to avoid this as I want my pod to be able to consume as much CPU as possible, and I also don't want multiple pods to interact via the local ssd.
How do I prevent scheduling of more than one pod of my type onto the node? I was thinking daemon sets at first, but I think down the line, I want to set my node pool to auto scale, that way when I have n nodes in my pool, and I request n+1 replicas, the node pool automatically scales up.
kubernetes google-container-engine
In my application, I have a rest server which locally interacts with a database via the command line (it's a long story). Anyway, the database is mounted in a local ssd on the node. I can guarantee that only pods of that type will by scheduled in the node pool, as I have tainted the nodes and added tolerances to my pods.
What I want to know is, how can I prevent kubernetes from scheduling multiple instances of my pod on a single node? I want to avoid this as I want my pod to be able to consume as much CPU as possible, and I also don't want multiple pods to interact via the local ssd.
How do I prevent scheduling of more than one pod of my type onto the node? I was thinking daemon sets at first, but I think down the line, I want to set my node pool to auto scale, that way when I have n nodes in my pool, and I request n+1 replicas, the node pool automatically scales up.
kubernetes google-container-engine
kubernetes google-container-engine
asked Mar 8 at 16:30
AndyAndy
81741121
81741121
1
I think you just create a daemonset and setup node scaling independent of this. when a new node is added , a pod will be automatically run on that. I see that a cleaner way
– Ijaz Ahmad Khan
Mar 9 at 11:02
add a comment |
1
I think you just create a daemonset and setup node scaling independent of this. when a new node is added , a pod will be automatically run on that. I see that a cleaner way
– Ijaz Ahmad Khan
Mar 9 at 11:02
1
1
I think you just create a daemonset and setup node scaling independent of this. when a new node is added , a pod will be automatically run on that. I see that a cleaner way
– Ijaz Ahmad Khan
Mar 9 at 11:02
I think you just create a daemonset and setup node scaling independent of this. when a new node is added , a pod will be automatically run on that. I see that a cleaner way
– Ijaz Ahmad Khan
Mar 9 at 11:02
add a comment |
3 Answers
3
active
oldest
votes
You can use Daemonsets
in combination with nodeSelector
or affinity
. Alternatively you could configure podAntiAffinity
on your Pod
s, for example:
apiVersion: apps/v1
kind: Deployment
metadata:
name: rest-server
spec:
selector:
matchLabels:
app: rest-server
replicas: 3
template:
metadata:
labels:
app: rest-server
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- rest-server
topologyKey: "kubernetes.io/hostname"
containers:
- name: rest-server
image: nginx:1.12-alpine
add a comment |
Depending on what you are trying to achieve, DaemonSets might not be a complete answer, because DaemonSet is NOT auto scaled, and it will only place a pod in a new node; when you add new nodes to your pool.
If you are looking to modify your workload with n+1 replicas,it’s better to use podAntiAffinity, controlling scheduling with node taints and cluster autoscaler; this will guarantee that a new node will be added when you increase your pods and deleted when you scale down your pods:
apiVersion: v1
kind: ReplicationController
metadata:
name: echoheaders
spec:
replicas: 1
template:
metadata:
labels:
app: echoheaders
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- echoheaders
topologyKey: "kubernetes.io/hostname"
containers:
- name: echoheaders
image: k8s.gcr.io/echoserver:1.4
ports:
- containerPort: 8080
tolerations:
- key: dedicated
operator: Equal
value: experimental
effect: NoSchedule
ReplicationController is not recommended anymore. Instead use a Deployment that configures a ReplicaSet to set up replication.
– webwurst
Mar 16 at 2:03
add a comment |
I can suggest two ways of going about this. One is to restrict the number of pods schedulable on a node, and the other is to assign the pod to a given node while requesting for the entirety of the resources available in the node.
1. Restricting number of schedulable pods per node
You can set this restriction when you're creating a new cluster, however it is limiting if later you change your mind. Find the following field in the advanced settings as you create the cluster.
2. Assigning pod to specific node and occupying all resources
Another option is to set the resource request numbers such that they match a node's resources, and assign it to a given node, using the nodeSelector
and labels
.
Check out this link for how to assign pods to a specific node.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55067254%2fhow-to-ensure-only-one-pod-runs-on-my-node-in-gke%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use Daemonsets
in combination with nodeSelector
or affinity
. Alternatively you could configure podAntiAffinity
on your Pod
s, for example:
apiVersion: apps/v1
kind: Deployment
metadata:
name: rest-server
spec:
selector:
matchLabels:
app: rest-server
replicas: 3
template:
metadata:
labels:
app: rest-server
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- rest-server
topologyKey: "kubernetes.io/hostname"
containers:
- name: rest-server
image: nginx:1.12-alpine
add a comment |
You can use Daemonsets
in combination with nodeSelector
or affinity
. Alternatively you could configure podAntiAffinity
on your Pod
s, for example:
apiVersion: apps/v1
kind: Deployment
metadata:
name: rest-server
spec:
selector:
matchLabels:
app: rest-server
replicas: 3
template:
metadata:
labels:
app: rest-server
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- rest-server
topologyKey: "kubernetes.io/hostname"
containers:
- name: rest-server
image: nginx:1.12-alpine
add a comment |
You can use Daemonsets
in combination with nodeSelector
or affinity
. Alternatively you could configure podAntiAffinity
on your Pod
s, for example:
apiVersion: apps/v1
kind: Deployment
metadata:
name: rest-server
spec:
selector:
matchLabels:
app: rest-server
replicas: 3
template:
metadata:
labels:
app: rest-server
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- rest-server
topologyKey: "kubernetes.io/hostname"
containers:
- name: rest-server
image: nginx:1.12-alpine
You can use Daemonsets
in combination with nodeSelector
or affinity
. Alternatively you could configure podAntiAffinity
on your Pod
s, for example:
apiVersion: apps/v1
kind: Deployment
metadata:
name: rest-server
spec:
selector:
matchLabels:
app: rest-server
replicas: 3
template:
metadata:
labels:
app: rest-server
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- rest-server
topologyKey: "kubernetes.io/hostname"
containers:
- name: rest-server
image: nginx:1.12-alpine
answered Mar 9 at 14:40
webwurstwebwurst
3,46921828
3,46921828
add a comment |
add a comment |
Depending on what you are trying to achieve, DaemonSets might not be a complete answer, because DaemonSet is NOT auto scaled, and it will only place a pod in a new node; when you add new nodes to your pool.
If you are looking to modify your workload with n+1 replicas,it’s better to use podAntiAffinity, controlling scheduling with node taints and cluster autoscaler; this will guarantee that a new node will be added when you increase your pods and deleted when you scale down your pods:
apiVersion: v1
kind: ReplicationController
metadata:
name: echoheaders
spec:
replicas: 1
template:
metadata:
labels:
app: echoheaders
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- echoheaders
topologyKey: "kubernetes.io/hostname"
containers:
- name: echoheaders
image: k8s.gcr.io/echoserver:1.4
ports:
- containerPort: 8080
tolerations:
- key: dedicated
operator: Equal
value: experimental
effect: NoSchedule
ReplicationController is not recommended anymore. Instead use a Deployment that configures a ReplicaSet to set up replication.
– webwurst
Mar 16 at 2:03
add a comment |
Depending on what you are trying to achieve, DaemonSets might not be a complete answer, because DaemonSet is NOT auto scaled, and it will only place a pod in a new node; when you add new nodes to your pool.
If you are looking to modify your workload with n+1 replicas,it’s better to use podAntiAffinity, controlling scheduling with node taints and cluster autoscaler; this will guarantee that a new node will be added when you increase your pods and deleted when you scale down your pods:
apiVersion: v1
kind: ReplicationController
metadata:
name: echoheaders
spec:
replicas: 1
template:
metadata:
labels:
app: echoheaders
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- echoheaders
topologyKey: "kubernetes.io/hostname"
containers:
- name: echoheaders
image: k8s.gcr.io/echoserver:1.4
ports:
- containerPort: 8080
tolerations:
- key: dedicated
operator: Equal
value: experimental
effect: NoSchedule
ReplicationController is not recommended anymore. Instead use a Deployment that configures a ReplicaSet to set up replication.
– webwurst
Mar 16 at 2:03
add a comment |
Depending on what you are trying to achieve, DaemonSets might not be a complete answer, because DaemonSet is NOT auto scaled, and it will only place a pod in a new node; when you add new nodes to your pool.
If you are looking to modify your workload with n+1 replicas,it’s better to use podAntiAffinity, controlling scheduling with node taints and cluster autoscaler; this will guarantee that a new node will be added when you increase your pods and deleted when you scale down your pods:
apiVersion: v1
kind: ReplicationController
metadata:
name: echoheaders
spec:
replicas: 1
template:
metadata:
labels:
app: echoheaders
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- echoheaders
topologyKey: "kubernetes.io/hostname"
containers:
- name: echoheaders
image: k8s.gcr.io/echoserver:1.4
ports:
- containerPort: 8080
tolerations:
- key: dedicated
operator: Equal
value: experimental
effect: NoSchedule
Depending on what you are trying to achieve, DaemonSets might not be a complete answer, because DaemonSet is NOT auto scaled, and it will only place a pod in a new node; when you add new nodes to your pool.
If you are looking to modify your workload with n+1 replicas,it’s better to use podAntiAffinity, controlling scheduling with node taints and cluster autoscaler; this will guarantee that a new node will be added when you increase your pods and deleted when you scale down your pods:
apiVersion: v1
kind: ReplicationController
metadata:
name: echoheaders
spec:
replicas: 1
template:
metadata:
labels:
app: echoheaders
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- echoheaders
topologyKey: "kubernetes.io/hostname"
containers:
- name: echoheaders
image: k8s.gcr.io/echoserver:1.4
ports:
- containerPort: 8080
tolerations:
- key: dedicated
operator: Equal
value: experimental
effect: NoSchedule
edited Mar 20 at 14:58
Nur
975
975
answered Mar 15 at 20:37
Ahmad ParsaeiAhmad Parsaei
192
192
ReplicationController is not recommended anymore. Instead use a Deployment that configures a ReplicaSet to set up replication.
– webwurst
Mar 16 at 2:03
add a comment |
ReplicationController is not recommended anymore. Instead use a Deployment that configures a ReplicaSet to set up replication.
– webwurst
Mar 16 at 2:03
ReplicationController is not recommended anymore. Instead use a Deployment that configures a ReplicaSet to set up replication.
– webwurst
Mar 16 at 2:03
ReplicationController is not recommended anymore. Instead use a Deployment that configures a ReplicaSet to set up replication.
– webwurst
Mar 16 at 2:03
add a comment |
I can suggest two ways of going about this. One is to restrict the number of pods schedulable on a node, and the other is to assign the pod to a given node while requesting for the entirety of the resources available in the node.
1. Restricting number of schedulable pods per node
You can set this restriction when you're creating a new cluster, however it is limiting if later you change your mind. Find the following field in the advanced settings as you create the cluster.
2. Assigning pod to specific node and occupying all resources
Another option is to set the resource request numbers such that they match a node's resources, and assign it to a given node, using the nodeSelector
and labels
.
Check out this link for how to assign pods to a specific node.
add a comment |
I can suggest two ways of going about this. One is to restrict the number of pods schedulable on a node, and the other is to assign the pod to a given node while requesting for the entirety of the resources available in the node.
1. Restricting number of schedulable pods per node
You can set this restriction when you're creating a new cluster, however it is limiting if later you change your mind. Find the following field in the advanced settings as you create the cluster.
2. Assigning pod to specific node and occupying all resources
Another option is to set the resource request numbers such that they match a node's resources, and assign it to a given node, using the nodeSelector
and labels
.
Check out this link for how to assign pods to a specific node.
add a comment |
I can suggest two ways of going about this. One is to restrict the number of pods schedulable on a node, and the other is to assign the pod to a given node while requesting for the entirety of the resources available in the node.
1. Restricting number of schedulable pods per node
You can set this restriction when you're creating a new cluster, however it is limiting if later you change your mind. Find the following field in the advanced settings as you create the cluster.
2. Assigning pod to specific node and occupying all resources
Another option is to set the resource request numbers such that they match a node's resources, and assign it to a given node, using the nodeSelector
and labels
.
Check out this link for how to assign pods to a specific node.
I can suggest two ways of going about this. One is to restrict the number of pods schedulable on a node, and the other is to assign the pod to a given node while requesting for the entirety of the resources available in the node.
1. Restricting number of schedulable pods per node
You can set this restriction when you're creating a new cluster, however it is limiting if later you change your mind. Find the following field in the advanced settings as you create the cluster.
2. Assigning pod to specific node and occupying all resources
Another option is to set the resource request numbers such that they match a node's resources, and assign it to a given node, using the nodeSelector
and labels
.
Check out this link for how to assign pods to a specific node.
answered Mar 8 at 18:31
cookiedoughcookiedough
1,3491732
1,3491732
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55067254%2fhow-to-ensure-only-one-pod-runs-on-my-node-in-gke%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
I think you just create a daemonset and setup node scaling independent of this. when a new node is added , a pod will be automatically run on that. I see that a cleaner way
– Ijaz Ahmad Khan
Mar 9 at 11:02