{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/24056974","id":24056974,"diff_hunk":"@@ -0,0 +1,120 @@\n+## Node selection example\n+\n+This example shows how to assign a pod to a specific node or to one of a set of nodes using node labels and the NodeSelector API resource. You may want to do this if some subset of your machines is special in some way, such as having SSDs attached to them.\n+\n+### Step Zero: Prerequisites\n+\n+This example assumes that you have a basic understanding of kubernetes pods and that you have [turned up a Kubernetes cluster](https://github.com/GoogleCloudPlatform/kubernetes#documentation):\n+\n+### Step One: Attach label to the node\n+\n+Run `kubectl get nodes` to get the names of the nodes. Pick out the one that you want to add a label to. Note that label keys are not allowed to contain any upper-case letters. Then run `kubectl get node <node-name> -o yaml > node.yaml`. The contents of the file should look something like this:\n+\n+<pre>\n+apiVersion: v1beta1\n+creationTimestamp: 2015-02-03T01:16:46Z\n+hostIP: 104.154.60.112\n+id: <node-name>\n+kind: Node\n+resourceVersion: 12\n+resources:\n+  capacity:\n+    cpu: \"1\"\n+    memory: 4.0265318e+09\n+selfLink: /api/v1beta1/minions/<node-name>\n+status:\n+  conditions:\n+  - kind: Ready\n+    lastTransitionTime: null\n+    status: Full\n+uid: 526a4156-ab42-11e4-9817-42010af0258d\n+</pre>\n+\n+Add the labels that you want to the file like this:\n+\n+<pre>\n+apiVersion: v1beta1\n+creationTimestamp: 2015-02-03T01:16:46Z\n+hostIP: 104.154.60.112\n+id: <node-name>\n+kind: Node\n+<b>labels:\n+  disktype: ssd</b>\n+resourceVersion: 12\n+resources:\n+  capacity:\n+    cpu: \"1\"\n+    memory: 4.0265318e+09\n+selfLink: /api/v1beta1/minions/<node-name>\n+status:\n+  conditions:\n+  - kind: Ready\n+    lastTransitionTime: null\n+    status: Full\n+uid: 526a4156-ab42-11e4-9817-42010af0258d\n+</pre>\n+\n+Then update the node by running `kubectl update -f node.yaml`. Make sure that the resourceVersion you use in your update call is the same as the resourceVersion returned by the get call. If something about the node changes between your get and your update, the update will fail because the resourceVersion will have changed.\n+\n+Note that as of 2015-02-03 there are a couple open issues that prevent this from working without modification. Due to [issue #3005](https://github.com/GoogleCloudPlatform/kubernetes/issues/3005), you have to remove all status-related fields from the file, which is both everything under the `status` field as well as the `hostIP` field. Due to [issue 4041](https://github.com/GoogleCloudPlatform/kubernetes/issues/4041), you may have to modify the representation of the resource capacity numbers to make them integers. These are both temporary, and fixes are being worked on. In the meantime, you would actually call `kubectl update -f node.yaml` with a file that looks like this:","path":"examples/node-selection/README.md","position":59,"original_position":59,"commit_id":"f17f2d521c7c153bc5d8845a22093d4ed9df2cfc","original_commit_id":"f17f2d521c7c153bc5d8845a22093d4ed9df2cfc","user":{"login":"ddysher","id":2191361,"avatar_url":"https://avatars.githubusercontent.com/u/2191361?v=3","gravatar_id":"","url":"https://api.github.com/users/ddysher","html_url":"https://github.com/ddysher","followers_url":"https://api.github.com/users/ddysher/followers","following_url":"https://api.github.com/users/ddysher/following{/other_user}","gists_url":"https://api.github.com/users/ddysher/gists{/gist_id}","starred_url":"https://api.github.com/users/ddysher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ddysher/subscriptions","organizations_url":"https://api.github.com/users/ddysher/orgs","repos_url":"https://api.github.com/users/ddysher/repos","events_url":"https://api.github.com/users/ddysher/events{/privacy}","received_events_url":"https://api.github.com/users/ddysher/received_events","type":"User","site_admin":false},"body":"Removing `hostIP` is only required for v1beta1/2.","created_at":"2015-02-04T01:40:52Z","updated_at":"2015-02-04T01:40:52Z","html_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/4088#discussion_r24056974","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/4088","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/24056974"},"html":{"href":"https://github.com/GoogleCloudPlatform/kubernetes/pull/4088#discussion_r24056974"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/4088"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/4088","id":28599664,"html_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/4088","diff_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/4088.diff","patch_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/4088.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/4088","number":4088,"state":"open","locked":false,"title":"Add an example of how to attach labels to nodes and use nodeSelectors so...","user":{"login":"a-robinson","id":7085343,"avatar_url":"https://avatars.githubusercontent.com/u/7085343?v=3","gravatar_id":"","url":"https://api.github.com/users/a-robinson","html_url":"https://github.com/a-robinson","followers_url":"https://api.github.com/users/a-robinson/followers","following_url":"https://api.github.com/users/a-robinson/following{/other_user}","gists_url":"https://api.github.com/users/a-robinson/gists{/gist_id}","starred_url":"https://api.github.com/users/a-robinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a-robinson/subscriptions","organizations_url":"https://api.github.com/users/a-robinson/orgs","repos_url":"https://api.github.com/users/a-robinson/repos","events_url":"https://api.github.com/users/a-robinson/events{/privacy}","received_events_url":"https://api.github.com/users/a-robinson/received_events","type":"User","site_admin":false},"body":"... that pods can be scheduled on specific nodes.","created_at":"2015-02-03T23:27:31Z","updated_at":"2015-02-04T01:40:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e992958c038fb7d39157ae8d2bf2eaedeaa28164","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/4088/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/4088/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/{number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/4088/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/f17f2d521c7c153bc5d8845a22093d4ed9df2cfc","head":{"label":"a-robinson:nodelabels","ref":"nodelabels","sha":"f17f2d521c7c153bc5d8845a22093d4ed9df2cfc","user":{"login":"a-robinson","id":7085343,"avatar_url":"https://avatars.githubusercontent.com/u/7085343?v=3","gravatar_id":"","url":"https://api.github.com/users/a-robinson","html_url":"https://github.com/a-robinson","followers_url":"https://api.github.com/users/a-robinson/followers","following_url":"https://api.github.com/users/a-robinson/following{/other_user}","gists_url":"https://api.github.com/users/a-robinson/gists{/gist_id}","starred_url":"https://api.github.com/users/a-robinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a-robinson/subscriptions","organizations_url":"https://api.github.com/users/a-robinson/orgs","repos_url":"https://api.github.com/users/a-robinson/repos","events_url":"https://api.github.com/users/a-robinson/events{/privacy}","received_events_url":"https://api.github.com/users/a-robinson/received_events","type":"User","site_admin":false},"repo":{"id":27797998,"name":"kubernetes","full_name":"a-robinson/kubernetes","owner":{"login":"a-robinson","id":7085343,"avatar_url":"https://avatars.githubusercontent.com/u/7085343?v=3","gravatar_id":"","url":"https://api.github.com/users/a-robinson","html_url":"https://github.com/a-robinson","followers_url":"https://api.github.com/users/a-robinson/followers","following_url":"https://api.github.com/users/a-robinson/following{/other_user}","gists_url":"https://api.github.com/users/a-robinson/gists{/gist_id}","starred_url":"https://api.github.com/users/a-robinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a-robinson/subscriptions","organizations_url":"https://api.github.com/users/a-robinson/orgs","repos_url":"https://api.github.com/users/a-robinson/repos","events_url":"https://api.github.com/users/a-robinson/events{/privacy}","received_events_url":"https://api.github.com/users/a-robinson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/a-robinson/kubernetes","description":"Container Cluster Manager","fork":true,"url":"https://api.github.com/repos/a-robinson/kubernetes","forks_url":"https://api.github.com/repos/a-robinson/kubernetes/forks","keys_url":"https://api.github.com/repos/a-robinson/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/a-robinson/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/a-robinson/kubernetes/teams","hooks_url":"https://api.github.com/repos/a-robinson/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/a-robinson/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/a-robinson/kubernetes/events","assignees_url":"https://api.github.com/repos/a-robinson/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/a-robinson/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/a-robinson/kubernetes/tags","blobs_url":"https://api.github.com/repos/a-robinson/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/a-robinson/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/a-robinson/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/a-robinson/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/a-robinson/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/a-robinson/kubernetes/languages","stargazers_url":"https://api.github.com/repos/a-robinson/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/a-robinson/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/a-robinson/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/a-robinson/kubernetes/subscription","commits_url":"https://api.github.com/repos/a-robinson/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/a-robinson/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/a-robinson/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/a-robinson/kubernetes/issues/comments/{number}","contents_url":"https://api.github.com/repos/a-robinson/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/a-robinson/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/a-robinson/kubernetes/merges","archive_url":"https://api.github.com/repos/a-robinson/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/a-robinson/kubernetes/downloads","issues_url":"https://api.github.com/repos/a-robinson/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/a-robinson/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/a-robinson/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/a-robinson/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/a-robinson/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/a-robinson/kubernetes/releases{/id}","created_at":"2014-12-10T02:14:07Z","updated_at":"2015-02-02T21:24:44Z","pushed_at":"2015-02-03T23:27:09Z","git_url":"git://github.com/a-robinson/kubernetes.git","ssh_url":"git@github.com:a-robinson/kubernetes.git","clone_url":"https://github.com/a-robinson/kubernetes.git","svn_url":"https://github.com/a-robinson/kubernetes","homepage":null,"size":26757,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"acbadc8ade492fe633e5355994df62738f006bde","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":20580498,"name":"kubernetes","full_name":"GoogleCloudPlatform/kubernetes","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/kubernetes","description":"Container Cluster Manager","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/comments/{number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/releases{/id}","created_at":"2014-06-06T22:56:04Z","updated_at":"2015-02-04T01:40:16Z","pushed_at":"2015-02-04T01:40:16Z","git_url":"git://github.com/GoogleCloudPlatform/kubernetes.git","ssh_url":"git@github.com:GoogleCloudPlatform/kubernetes.git","clone_url":"https://github.com/GoogleCloudPlatform/kubernetes.git","svn_url":"https://github.com/GoogleCloudPlatform/kubernetes","homepage":"http://kubernetes.io","size":66945,"stargazers_count":6050,"watchers_count":6050,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1025,"mirror_url":null,"open_issues_count":651,"forks":1025,"open_issues":651,"watchers":6050,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/4088"},"html":{"href":"https://github.com/GoogleCloudPlatform/kubernetes/pull/4088"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/4088"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/4088/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/4088/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/4088/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/f17f2d521c7c153bc5d8845a22093d4ed9df2cfc"}}}}