From 29157f267b74f6c9fa2665c6cb5674902b327d9e Mon Sep 17 00:00:00 2001 From: Chao Xu Date: Wed, 6 May 2015 17:21:39 -0700 Subject: [PATCH] update nodeSelector example to use v1beta3 API --- examples/node-selection/README.md | 45 +++++++++++++++---------------- examples/node-selection/pod.yaml | 13 +++++++++ 2 files changed, 34 insertions(+), 24 deletions(-) create mode 100644 examples/node-selection/pod.yaml diff --git a/examples/node-selection/README.md b/examples/node-selection/README.md index 826d0cf31e..f22d624c2a 100644 --- a/examples/node-selection/README.md +++ b/examples/node-selection/README.md @@ -23,37 +23,34 @@ You can verify that it worked by re-running `kubectl get nodes` and checking tha Take whatever pod config file you want to run, and add a nodeSelector section to it, like this. For example, if this is my pod config:
-apiVersion: v1beta1
-desiredState:
-  manifest:
-    containers:
-      - image: nginx
-        name: nginx
-    id: nginx
-    version: v1beta1
-id: nginx
+apiVersion: v1beta3
 kind: Pod
-labels:
-  env: test
+metadata:
+  labels:
+    env: test
+  name: nginx
+spec:
+  containers:
+  - image: nginx
+    name: nginx
 
Then add a nodeSelector like so:
-apiVersion: v1beta1
-desiredState:
-  manifest:
-    containers:
-      - image: nginx
-        name: nginx
-    id: nginx
-    version: v1beta1
-id: nginx
+apiVersion: v1beta3
 kind: Pod
-labels:
-  env: test
-nodeSelector:
-  disktype: ssd
+metadata:
+  labels:
+    env: test
+  name: nginx
+spec:
+  containers:
+  - image: nginx
+    imagePullPolicy: IfNotPresent
+    name: nginx
+  nodeSelector:
+    disktype: ssd
 
When you then run `kubectl create -f pod.yaml`, the pod will get scheduled on the node that you attached the label to! You can verify that it worked by running `kubectl get pods` and looking at the "host" that the pod was assigned to. diff --git a/examples/node-selection/pod.yaml b/examples/node-selection/pod.yaml new file mode 100644 index 0000000000..42a6b39e8a --- /dev/null +++ b/examples/node-selection/pod.yaml @@ -0,0 +1,13 @@ +apiVersion: v1beta3 +kind: Pod +metadata: + labels: + env: test + name: nginx +spec: + containers: + - image: nginx + imagePullPolicy: IfNotPresent + name: nginx + nodeSelector: + disktype: ssd