From 4f3c2951822af0cd2365d47ff19f27015755fa97 Mon Sep 17 00:00:00 2001 From: Peter Lee Date: Sun, 15 Jan 2017 23:09:45 +0800 Subject: [PATCH 1/7] fix the named anchor name anchor `loading-and-merging` should be `loading-and-merging-rules` --- docs/user-guide/kubeconfig-file.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guide/kubeconfig-file.md b/docs/user-guide/kubeconfig-file.md index fd44eaf999..b4d7425127 100644 --- a/docs/user-guide/kubeconfig-file.md +++ b/docs/user-guide/kubeconfig-file.md @@ -16,7 +16,7 @@ So in order to easily switch between multiple clusters, for multiple users, a ku This file contains a series of authentication mechanisms and cluster connection information associated with nicknames. It also introduces the concept of a tuple of authentication information (user) and cluster connection information called a context that is also associated with a nickname. -Multiple kubeconfig files are allowed, if specified explicitly. At runtime they are loaded and merged along with override options specified from the command line (see [rules](#loading-and-merging) below). +Multiple kubeconfig files are allowed, if specified explicitly. At runtime they are loaded and merged along with override options specified from the command line (see [rules](#loading-and-merging-rules) below). ## Related discussion From 26385f0e46a85da5c8d3cc2f0e2a20f869d71484 Mon Sep 17 00:00:00 2001 From: steveperry-53 Date: Tue, 10 Jan 2017 15:49:33 -0800 Subject: [PATCH 2/7] Write new Task: Attaching Handlers to Container Lifecycle Events. --- _data/tasks.yml | 3 +- .../attach-handler-lifecycle-event.md | 72 +++++++++++++++++++ .../lifecycle-events.yaml | 33 +++++++++ docs/tasks/index.md | 1 + 4 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 docs/tasks/configure-pod-container/attach-handler-lifecycle-event.md create mode 100644 docs/tasks/configure-pod-container/lifecycle-events.yaml diff --git a/_data/tasks.yml b/_data/tasks.yml index 9605e925b0..13315bf5ed 100644 --- a/_data/tasks.yml +++ b/_data/tasks.yml @@ -13,7 +13,8 @@ toc: - docs/tasks/configure-pod-container/pull-image-private-registry.md - docs/tasks/configure-pod-container/configure-liveness-readiness-probes.md - docs/tasks/configure-pod-container/communicate-containers-same-pod.md - - docs/tasks/configure-pod-container/configure-pod-initialization.md + - docs/tasks/configure-pod-container/configure-pod-initialization.md + - docs/tasks/configure-pod-container/attach-handler-lifecycle-event.md - title: Accessing Applications in a Cluster section: diff --git a/docs/tasks/configure-pod-container/attach-handler-lifecycle-event.md b/docs/tasks/configure-pod-container/attach-handler-lifecycle-event.md new file mode 100644 index 0000000000..e6492c7577 --- /dev/null +++ b/docs/tasks/configure-pod-container/attach-handler-lifecycle-event.md @@ -0,0 +1,72 @@ +--- +title: Attaching Handlers to Container Lifecycle Events +--- + +{% capture overview %} + +This page shows how to attach handlers to Container lifecycle events. Kubernetes supports +the postStart event and the preStop event. Kubernetes sends the postStart event immediately +after a Container is started, and it sends the preStop event immediately before the +Container is terminated. + +{% endcapture %} + + +{% capture prerequisites %} + +{% include task-tutorial-prereqs.md %} + +{% endcapture %} + + +{% capture steps %} + +### Defining postStart and preStop handlers + +In this exercise, you create a Pod that has one Container. The Container has handlers +for the postStart and preStop events. + +Here is the configuration file for the Pod: + +{% include code.html language="yaml" file="lifecycle-events.yaml" ghlink="/docs/tasks/configure-pod-container/lifecycle-events.yaml" %} + +In the configuration file, you can see that the postStart command writes a `message` +file to the Container's `/usr/share` directory. The preStop command shuts down +nginx gracefully. This is helpful if the Container is being terminated because of a failure. + +Create the Pod: + + kubectl create -f http://k8s.io/docs/tasks/configure-pod-container/lifecycle-events.yaml + +Verify that the Container in the Pod is running: + + kubectl get pod lifecycle-demo + +Get a shell into the Container running in your Pod: + + kubectl exec -it lifecycle-demo -- /bin/bash + +In your shell, verify that the `postStart` handler created the `message` file: + + root@lifecycle-demo:/# cat /usr/share/message + +The output shows the text written by the postStart handler: + + Hello from the postStart handler + +{% endcapture %} + + +{% capture whatsnext %} + +* Learn more about [Container lifecycle hooks](/docs/user-guide/container-environment/.) +* Learn more about the [lifecycle of a Pod](https://kubernetes.io/docs/user-guide/pod-states/). + +#### Reference + +* [Lifecycle](https://kubernetes.io/docs/resources-reference/1_5/#lifecycle-v1) +* [Container](https://kubernetes.io/docs/resources-reference/1_5/#container-v1) + +{% endcapture %} + +{% include templates/task.md %} diff --git a/docs/tasks/configure-pod-container/lifecycle-events.yaml b/docs/tasks/configure-pod-container/lifecycle-events.yaml new file mode 100644 index 0000000000..c62028d7ef --- /dev/null +++ b/docs/tasks/configure-pod-container/lifecycle-events.yaml @@ -0,0 +1,33 @@ +apiVersion: v1 +kind: Pod +metadata: + name: lifecycle-demo +spec: + containers: + - name: lifecycle-demo-container + image: nginx + + lifecycle: + postStart: + exec: + command: ["/bin/sh", "-c", "echo Hello from the postStart handler > /usr/share/message"] + preStop: + exec: + command: ["/usr/sbin/nginx","-s","quit"] + + + + + + + + + + + + + + + + + diff --git a/docs/tasks/index.md b/docs/tasks/index.md index 2482a13677..b9d0284d5e 100644 --- a/docs/tasks/index.md +++ b/docs/tasks/index.md @@ -17,6 +17,7 @@ single thing, typically by giving a short sequence of steps. * [Configuring Liveness and Readiness Probes](/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/) * [Communicating Between Pods Running in the Same Container](/docs/tasks/configure-pod-container/communicate-containers-same-pod/) * [Configuring Pod Initialization](/docs/tasks/configure-pod-container/configure-pod-initialization/) +* [Attaching Handlers to Container Lifecycle Events](/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/) #### Accessing Applications in a Cluster From 6a6028c72704842d43a4668530ad4f43e33d4ee8 Mon Sep 17 00:00:00 2001 From: steveperry-53 Date: Tue, 17 Jan 2017 12:40:55 -0800 Subject: [PATCH 3/7] Address reviewer comments. --- .../attach-handler-lifecycle-event.md | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/docs/tasks/configure-pod-container/attach-handler-lifecycle-event.md b/docs/tasks/configure-pod-container/attach-handler-lifecycle-event.md index e6492c7577..715ea3effb 100644 --- a/docs/tasks/configure-pod-container/attach-handler-lifecycle-event.md +++ b/docs/tasks/configure-pod-container/attach-handler-lifecycle-event.md @@ -5,7 +5,7 @@ title: Attaching Handlers to Container Lifecycle Events {% capture overview %} This page shows how to attach handlers to Container lifecycle events. Kubernetes supports -the postStart event and the preStop event. Kubernetes sends the postStart event immediately +the postStart and preStop events. Kubernetes sends the postStart event immediately after a Container is started, and it sends the preStop event immediately before the Container is terminated. @@ -57,15 +57,37 @@ The output shows the text written by the postStart handler: {% endcapture %} + +{% capture discussion %} + +### Discussion + +Kubernetes sends the postStart event immediately after the Container is created. +There is no guarantee, however, that the postStart handler is called before +the Container's entrypoint is called. The postStart handler runs asynchronously +relative to the Container's code, but Kubernetes' management of the container +blocks until the postStart handler completes. The Container's status is not +set to RUNNING until the postStart handler completes. + +Kubernetes sends the preStop event immediately before the Container is terminated. +Kubernetes' management of the Container blocks until the preStop handler completes, +unless the Pod's grace period expires. For more details, see +[Termination of Pods](/docs/user-guide/pods/#termination-of-pods). + +{% endcapture %} + + {% capture whatsnext %} * Learn more about [Container lifecycle hooks](/docs/user-guide/container-environment/.) * Learn more about the [lifecycle of a Pod](https://kubernetes.io/docs/user-guide/pod-states/). -#### Reference +#### Reference + * [Lifecycle](https://kubernetes.io/docs/resources-reference/1_5/#lifecycle-v1) * [Container](https://kubernetes.io/docs/resources-reference/1_5/#container-v1) +* See `terminationGracePeriodSeconds` in [PodSpec](/docs/resources-reference/v1.5/#podspec-v1) {% endcapture %} From 8858b56753fab59c5f432ca4da837f682fe8e46a Mon Sep 17 00:00:00 2001 From: Nathan Quarles Date: Mon, 16 Jan 2017 09:38:07 -0500 Subject: [PATCH 4/7] grammar fix --- docs/tutorials/kubernetes-basics/explore-intro.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/kubernetes-basics/explore-intro.html b/docs/tutorials/kubernetes-basics/explore-intro.html index e16d2a0755..5f5cb6354e 100644 --- a/docs/tutorials/kubernetes-basics/explore-intro.html +++ b/docs/tutorials/kubernetes-basics/explore-intro.html @@ -28,7 +28,7 @@ title: Viewing Pods and Nodes

Kubernetes Pods

-

When you created a Deployment in Module 2, Kubernetes created a Pod to host your application instance. A Pod is Kubernetes abstraction that represents a group of one or more application containers (such as Docker or rkt), and some shared resources for those containers. Those resources include:

+

When you created a Deployment in Module 2, Kubernetes created a Pod to host your application instance. A Pod is a Kubernetes abstraction that represents a group of one or more application containers (such as Docker or rkt), and some shared resources for those containers. Those resources include:

  • Shared storage, as Volumes
  • Networking, as a unique cluster IP address
  • From 2495fb890d6fa5346cfbd6230ba08abf579b80c9 Mon Sep 17 00:00:00 2001 From: Francesc Rosas Date: Tue, 17 Jan 2017 14:57:48 +0000 Subject: [PATCH 5/7] Fix jsonpath --- docs/getting-started-guides/minikube.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting-started-guides/minikube.md b/docs/getting-started-guides/minikube.md index 65b7893be5..731ad1c9a4 100644 --- a/docs/getting-started-guides/minikube.md +++ b/docs/getting-started-guides/minikube.md @@ -225,7 +225,7 @@ Any services of type `NodePort` can be accessed over that IP address, on the Nod To determine the NodePort for your service, you can use a `kubectl` command like this: -`kubectl get service $SERVICE --output='jsonpath="{.spec.ports[0].NodePort}"'` +`kubectl get service $SERVICE --output='jsonpath="{.spec.ports[0].nodePort}"'` ## Persistent Volumes Minikube supports [PersistentVolumes](http://kubernetes.io/docs/user-guide/persistent-volumes/) of type `hostPath`. From 4a33f4f44c2648806ca77e60012c970d9968d607 Mon Sep 17 00:00:00 2001 From: Janet Kuo Date: Tue, 17 Jan 2017 15:16:27 -0800 Subject: [PATCH 6/7] Fix travis failure by bumping go version to 1.7.3 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 33db17d9e7..791d289e88 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: go go: - - 1.6.2 + - 1.7.3 # Don't want default ./... here: install: From 705f74fad0b6b69ed9dc693ba484e378d50f71c7 Mon Sep 17 00:00:00 2001 From: Michael Mrowetz Date: Fri, 13 Jan 2017 17:16:16 +0900 Subject: [PATCH 7/7] de-duplicated sentence. --- docs/admin/salt.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/admin/salt.md b/docs/admin/salt.md index d2479ffff2..ab495521bd 100644 --- a/docs/admin/salt.md +++ b/docs/admin/salt.md @@ -6,7 +6,7 @@ title: Configuring Kubernetes with Salt The Kubernetes cluster can be configured using Salt. -The Salt scripts are shared across multiple hosting providers, so it's important to understand some background information prior to making a modification to ensure your changes do not break hosting Kubernetes across multiple environments. Depending on where you host your Kubernetes cluster, you may be using different operating systems and different networking configurations. As a result, it's important to understand some background information before making Salt changes in order to minimize introducing failures for other hosting providers. +The Salt scripts are shared across multiple hosting providers and depending on where you host your Kubernetes cluster, you may be using different operating systems and different networking configurations. As a result, it's important to understand some background information before making Salt changes in order to minimize introducing failures for other hosting providers. ## Salt cluster setup