From 3dc4ccb62c2a2afde0241f9a68c2b414ac5b0f8c Mon Sep 17 00:00:00 2001 From: Suraj Deshmukh Date: Thu, 23 Nov 2017 12:08:27 +0530 Subject: [PATCH 1/4] Add PodPreset basic usage instructions --- .../inject-data-application/podpreset.md | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/docs/tasks/inject-data-application/podpreset.md b/docs/tasks/inject-data-application/podpreset.md index d2571ab844..51357494a7 100644 --- a/docs/tasks/inject-data-application/podpreset.md +++ b/docs/tasks/inject-data-application/podpreset.md @@ -20,18 +20,44 @@ You can get an overview of PodPresets at This is a simple example to show how a Pod spec is modified by the Pod Preset. -**User submitted pod spec:** +{% include code.html language="yaml" file="podpreset-preset.yaml" ghlink="/docs/tasks/inject-data-application/podpreset-preset.yaml" %} + +1. Create above PodPreset + + kubectl create -f https://k8s.io/docs/tasks/inject-data-application/podpreset-preset.yaml + + +1. See the created PodPreset + + $ kubectl get podpreset + NAME AGE + allow-database 1m + + Create above PodPreset, now any pod that has label `role: frontend` will have this + PodPreset acted upon. {% include code.html language="yaml" file="podpreset-pod.yaml" ghlink="/docs/tasks/inject-data-application/podpreset-pod.yaml" %} -**Example Pod Preset:** +1. Create Pod + + kubectl create -f https://k8s.io/docs/tasks/inject-data-application/podpreset-pod.yaml + +1. List the running Pods: + + $ kubectl get pods + NAME READY STATUS RESTARTS AGE + website 1/1 Running 0 4m -{% include code.html language="yaml" file="podpreset-preset.yaml" ghlink="/docs/tasks/inject-data-application/podpreset-preset.yaml" %} **Pod spec after admission controller:** {% include code.html language="yaml" file="podpreset-merged.yaml" ghlink="/docs/tasks/inject-data-application/podpreset-merged.yaml" %} +To see above output, run following command + + kubectl get pod website -o yaml + + ### Pod Spec with `ConfigMap` Example This is an example to show how a Pod spec is modified by the Pod Preset From 4c083fc73e58b9c800f860cf9c2f8625f82c48d0 Mon Sep 17 00:00:00 2001 From: Qiming Date: Thu, 23 Nov 2017 20:51:55 +0800 Subject: [PATCH 2/4] Update podpreset.md --- .../inject-data-application/podpreset.md | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/docs/tasks/inject-data-application/podpreset.md b/docs/tasks/inject-data-application/podpreset.md index 51357494a7..23fe195e30 100644 --- a/docs/tasks/inject-data-application/podpreset.md +++ b/docs/tasks/inject-data-application/podpreset.md @@ -22,41 +22,47 @@ Preset. {% include code.html language="yaml" file="podpreset-preset.yaml" ghlink="/docs/tasks/inject-data-application/podpreset-preset.yaml" %} -1. Create above PodPreset +1. Create the PodPreset: - kubectl create -f https://k8s.io/docs/tasks/inject-data-application/podpreset-preset.yaml +```shell +kubectl create -f https://k8s.io/docs/tasks/inject-data-application/podpreset-preset.yaml +``` +1. Examine the created PodPreset: -1. See the created PodPreset +```shell +kubectl get podpreset +NAME AGE +allow-database 1m +``` - $ kubectl get podpreset - NAME AGE - allow-database 1m - - Create above PodPreset, now any pod that has label `role: frontend` will have this - PodPreset acted upon. + The new PodPreset will act upon any pod that has label `role: frontend`. {% include code.html language="yaml" file="podpreset-pod.yaml" ghlink="/docs/tasks/inject-data-application/podpreset-pod.yaml" %} 1. Create Pod - kubectl create -f https://k8s.io/docs/tasks/inject-data-application/podpreset-pod.yaml +```shell +kubectl create -f https://k8s.io/docs/tasks/inject-data-application/podpreset-pod.yaml +``` 1. List the running Pods: - $ kubectl get pods - NAME READY STATUS RESTARTS AGE - website 1/1 Running 0 4m - +```shell +kubectl get pods +NAME READY STATUS RESTARTS AGE +website 1/1 Running 0 4m +``` **Pod spec after admission controller:** {% include code.html language="yaml" file="podpreset-merged.yaml" ghlink="/docs/tasks/inject-data-application/podpreset-merged.yaml" %} -To see above output, run following command - - kubectl get pod website -o yaml +To see above output, run the following command: +```shell +kubectl get pod website -o yaml +``` ### Pod Spec with `ConfigMap` Example From 7df85566532e5c24adf10a1b00e297c425ec0019 Mon Sep 17 00:00:00 2001 From: Qiming Date: Thu, 23 Nov 2017 20:53:58 +0800 Subject: [PATCH 3/4] Update podpreset.md --- docs/tasks/inject-data-application/podpreset.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/tasks/inject-data-application/podpreset.md b/docs/tasks/inject-data-application/podpreset.md index 23fe195e30..707a451eff 100644 --- a/docs/tasks/inject-data-application/podpreset.md +++ b/docs/tasks/inject-data-application/podpreset.md @@ -22,13 +22,13 @@ Preset. {% include code.html language="yaml" file="podpreset-preset.yaml" ghlink="/docs/tasks/inject-data-application/podpreset-preset.yaml" %} -1. Create the PodPreset: +Create the PodPreset: ```shell kubectl create -f https://k8s.io/docs/tasks/inject-data-application/podpreset-preset.yaml ``` -1. Examine the created PodPreset: +Examine the created PodPreset: ```shell kubectl get podpreset @@ -36,17 +36,17 @@ NAME AGE allow-database 1m ``` - The new PodPreset will act upon any pod that has label `role: frontend`. +The new PodPreset will act upon any pod that has label `role: frontend`. {% include code.html language="yaml" file="podpreset-pod.yaml" ghlink="/docs/tasks/inject-data-application/podpreset-pod.yaml" %} -1. Create Pod +Create a pod: ```shell kubectl create -f https://k8s.io/docs/tasks/inject-data-application/podpreset-pod.yaml ``` -1. List the running Pods: +List the running Pods: ```shell kubectl get pods From 4c347ea69d86d9c9c8100896c20ec87ea61d1078 Mon Sep 17 00:00:00 2001 From: Qiming Date: Fri, 24 Nov 2017 19:11:37 +0800 Subject: [PATCH 4/4] Update podpreset.md --- docs/tasks/inject-data-application/podpreset.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/tasks/inject-data-application/podpreset.md b/docs/tasks/inject-data-application/podpreset.md index 707a451eff..4368608690 100644 --- a/docs/tasks/inject-data-application/podpreset.md +++ b/docs/tasks/inject-data-application/podpreset.md @@ -31,7 +31,7 @@ kubectl create -f https://k8s.io/docs/tasks/inject-data-application/podpreset-pr Examine the created PodPreset: ```shell -kubectl get podpreset +$ kubectl get podpreset NAME AGE allow-database 1m ``` @@ -43,13 +43,13 @@ The new PodPreset will act upon any pod that has label `role: frontend`. Create a pod: ```shell -kubectl create -f https://k8s.io/docs/tasks/inject-data-application/podpreset-pod.yaml +$ kubectl create -f https://k8s.io/docs/tasks/inject-data-application/podpreset-pod.yaml ``` List the running Pods: ```shell -kubectl get pods +$ kubectl get pods NAME READY STATUS RESTARTS AGE website 1/1 Running 0 4m ``` @@ -61,7 +61,7 @@ website 1/1 Running 0 4m To see above output, run the following command: ```shell -kubectl get pod website -o yaml +$ kubectl get pod website -o yaml ``` ### Pod Spec with `ConfigMap` Example @@ -145,7 +145,7 @@ when there is a conflict. **If we run `kubectl describe...` we can see the event:** -``` +```shell $ kubectl describe ... .... Events: