Difference between revisions of "Tips:How to ensure your pod ends up on a specific node"
Jump to navigation
Jump to search
m (→Specifying node placement in the pod) |
m (→Specifying node placement in the pod) |
||
| Line 4: | Line 4: | ||
<syntaxhighlight lang="yaml"> | <syntaxhighlight lang="yaml"> | ||
| − | apiVersion: | + | apiVersion: v1 |
kind: Pod | kind: Pod | ||
metadata: | metadata: | ||
| Line 11: | Line 11: | ||
nodeSelector: | nodeSelector: | ||
kubernetes.io/hostname: vecna | kubernetes.io/hostname: vecna | ||
| + | ... | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Latest revision as of 12:24, 4 July 2020
Specifying node placement in the pod
Node affinity is specified with a node selector as follows. Here, the system will try to place the pod on the node with hostname "vecna", i.e. the DGX2.
apiVersion: v1
kind: Pod
metadata:
name: ...
spec:
nodeSelector:
kubernetes.io/hostname: vecna
...
There is a ton of different options and other possibilities, see
Assigning pods to nodes (Kubernetes tutorial)
Node labels pre-defined in the cluster which can be used to specify pod affinity and selectors
TODO