From 268c9473a5eefd7ac02e6e5d5f447e1fa27920c4 Mon Sep 17 00:00:00 2001 From: WanLinghao Date: Thu, 28 Feb 2019 13:22:19 +0800 Subject: [PATCH] Add docs to illustrate how to schedule pod to specific node (#12871) --- .../tasks/configure-pod-container/assign-pods-nodes.md | 7 +++++++ content/en/examples/examples_test.go | 1 + content/en/examples/pods/pod-nginx-specific-node.yaml | 10 ++++++++++ 3 files changed, 18 insertions(+) create mode 100644 content/en/examples/pods/pod-nginx-specific-node.yaml diff --git a/content/en/docs/tasks/configure-pod-container/assign-pods-nodes.md b/content/en/docs/tasks/configure-pod-container/assign-pods-nodes.md index 7b7c912123..25247a1a00 100644 --- a/content/en/docs/tasks/configure-pod-container/assign-pods-nodes.md +++ b/content/en/docs/tasks/configure-pod-container/assign-pods-nodes.md @@ -86,6 +86,13 @@ a `disktype=ssd` label. NAME READY STATUS RESTARTS AGE IP NODE nginx 1/1 Running 0 13s 10.200.0.4 worker0 ``` +## Create a pod that gets scheduled to specific node + +You can also schedule a pod to one specific node via setting `nodeName`. + +{{< codenew file="pods/pod-nginx-specific-node.yaml" >}} + +Use the configuration file to create a pod that will get scheduled on `foo-node` only. {{% /capture %}} diff --git a/content/en/examples/examples_test.go b/content/en/examples/examples_test.go index 08cceb5fd1..1b81a1aeac 100644 --- a/content/en/examples/examples_test.go +++ b/content/en/examples/examples_test.go @@ -446,6 +446,7 @@ func TestExampleObjectSchemas(t *testing.T) { "commands": {&api.Pod{}}, "init-containers": {&api.Pod{}}, "lifecycle-events": {&api.Pod{}}, + "pod-nginx-specific-node": {&api.Pod{}}, "pod-nginx": {&api.Pod{}}, "pod-with-node-affinity": {&api.Pod{}}, "pod-with-pod-affinity": {&api.Pod{}}, diff --git a/content/en/examples/pods/pod-nginx-specific-node.yaml b/content/en/examples/pods/pod-nginx-specific-node.yaml new file mode 100644 index 0000000000..5923400d64 --- /dev/null +++ b/content/en/examples/pods/pod-nginx-specific-node.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Pod +metadata: + name: nginx +spec: + nodeName: foo-node # schedule pod to specific node + containers: + - name: nginx + image: nginx + imagePullPolicy: IfNotPresent