From 02d17ade5fd1205151d0c01e1c40e0e156388892 Mon Sep 17 00:00:00 2001 From: steveperry-53 Date: Wed, 18 Jan 2017 10:18:37 -0800 Subject: [PATCH] Reduce heading levels by 1. --- _includes/templates/concept.md | 2 +- _includes/templates/task.md | 4 +-- _includes/templates/tutorial.md | 8 ++--- .../abstractions/controllers/statefulsets.md | 16 +++++----- docs/concepts/abstractions/overview.md | 10 +++---- docs/concepts/abstractions/pod.md | 14 ++++----- docs/concepts/object-metadata/annotations.md | 2 +- ...load-balance-access-application-cluster.md | 13 ++------ ...port-forward-access-application-cluster.md | 6 ++-- .../http-proxy-access-api.md | 4 +-- .../administer-cluster/assign-pods-nodes.md | 4 +-- .../change-pv-reclaim-policy.md | 6 ++-- .../dns-horizontal-autoscaling.md | 22 +++++++------- .../administer-cluster/safely-drain-node.md | 4 +-- .../assign-cpu-ram-container.md | 6 ++-- .../attach-handler-lifecycle-event.md | 6 ++-- .../communicate-containers-same-pod.md | 4 +-- .../configure-liveness-readiness-probes.md | 12 ++++---- .../configure-pod-initialization.md | 2 +- .../configure-volume-storage.md | 2 +- .../define-command-argument-container.md | 6 ++-- .../define-environment-variable-container.md | 2 +- .../distribute-credentials-secure.md | 10 +++---- .../pull-image-private-registry.md | 8 ++--- .../determine-reason-pod-failure.md | 4 +-- .../debugging-a-statefulset.md | 4 +-- docs/tasks/manage-stateful-set/delete-pods.md | 6 ++-- .../deleting-a-statefulset.md | 8 ++--- .../manage-stateful-set/scale-stateful-set.md | 10 +++---- .../upgrade-pet-set-to-stateful-set.md | 18 +++++------ .../troubleshoot/debug-init-containers.md | 8 ++--- docs/tutorials/services/source-ip.md | 10 +++---- .../basic-stateful-set.md | 28 ++++++++--------- .../run-replicated-stateful-application.md | 28 ++++++++--------- .../run-stateful-application.md | 10 +++---- .../stateful-application/zookeeper.md | 30 +++++++++---------- .../expose-external-ip-address-service.md | 4 +-- .../expose-external-ip-address.md | 2 +- .../stateless-application/hello-minikube.md | 14 ++++----- .../run-stateless-application-deployment.md | 8 ++--- 40 files changed, 178 insertions(+), 187 deletions(-) diff --git a/_includes/templates/concept.md b/_includes/templates/concept.md index dc6efdad13..65edc7f808 100644 --- a/_includes/templates/concept.md +++ b/_includes/templates/concept.md @@ -24,7 +24,7 @@ {% if whatsnext %} -### What's next +## What's next {{ whatsnext }} diff --git a/_includes/templates/task.md b/_includes/templates/task.md index d74ff3b97a..e76cb7b117 100644 --- a/_includes/templates/task.md +++ b/_includes/templates/task.md @@ -15,7 +15,7 @@ {% if prerequisites %} -### Before you begin +## Before you begin {{ prerequisites }} @@ -48,7 +48,7 @@ {% if whatsnext %} -### What's next +## What's next {{ whatsnext }} diff --git a/_includes/templates/tutorial.md b/_includes/templates/tutorial.md index 9c2d680643..b4c1faa0f1 100644 --- a/_includes/templates/tutorial.md +++ b/_includes/templates/tutorial.md @@ -15,7 +15,7 @@ {% if objectives %} -### Objectives +## Objectives {{ objectives }} @@ -28,7 +28,7 @@ {% if prerequisites %} -### Before you begin +## Before you begin {{ prerequisites }} @@ -52,7 +52,7 @@ {% if cleanup %} -### Cleaning up +## Cleaning up {{ cleanup }} @@ -61,7 +61,7 @@ {% if whatsnext %} -### What's next +## What's next {{ whatsnext }} diff --git a/docs/concepts/abstractions/controllers/statefulsets.md b/docs/concepts/abstractions/controllers/statefulsets.md index 996a63fe8d..fb48e63ae0 100644 --- a/docs/concepts/abstractions/controllers/statefulsets.md +++ b/docs/concepts/abstractions/controllers/statefulsets.md @@ -22,7 +22,7 @@ guarantees about the ordering of deployment and scaling. {% capture body %} -### Using StatefulSets +## Using StatefulSets StatefulSets are valuable for applications that require one or more of the following. @@ -39,7 +39,7 @@ provides a set of stateless replicas. Controllers such as [Deployment](/docs/user-guide/deployments/) or [ReplicaSet](/docs/user-guide/replicasets/) may be better suited to your stateless needs. -### Limitations +## Limitations * StatefulSet is a beta resource, not available in any Kubernetes release prior to 1.5. * As with all alpha/beta resources, you can disable StatefulSet through the `--runtime-config` option passed to the apiserver. * The storage for a given Pod must either be provisioned by a [PersistentVolume Provisioner](http://releases.k8s.io/{{page.githubbranch}}/examples/experimental/persistent-volume-provisioning/README.md) based on the requested `storage class`, or pre-provisioned by an admin. @@ -47,7 +47,7 @@ provides a set of stateless replicas. Controllers such as * StatefulSets currently require a [Headless Service](/docs/user-guide/services/#headless-services) to be responsible for the network identity of the Pods. You are responsible for creating this Service. * Updating an existing StatefulSet is currently a manual process. -### Components +## Components The example below demonstrates the components of a StatefulSet. * A Headless Service, named nginx, is used to control the network domain. @@ -103,17 +103,17 @@ spec: storage: 1Gi ``` -### Pod Identity +## Pod Identity StatefulSet Pods have a unique identity that is comprised of an ordinal, a stable network identity, and stable storage. The identity sticks to the Pod, regardless of which node it's (re)scheduled on. -__Ordinal Index__ +### Ordinal Index For a StatefulSet with N replicas, each Pod in the StatefulSet will be assigned an integer ordinal, in the range [0,N), that is unique over the Set. -__Stable Network ID__ +### Stable Network ID Each Pod in a StatefulSet derives its hostname from the name of the StatefulSet and the ordinal of the Pod. The pattern for the constructed hostname @@ -139,7 +139,7 @@ Cluster Domain | Service (ns/name) | StatefulSet (ns/name) | StatefulSet Domain Note that Cluster Domain will be set to `cluster.local` unless [otherwise configured](http://releases.k8s.io/{{page.githubbranch}}/build/kube-dns/README.md#how-do-i-configure-it). -__Stable Storage__ +### Stable Storage Kubernetes creates one [PersistentVolume](/docs/user-guide/volumes/) for each VolumeClaimTemplate. In the nginx example above, each Pod will receive a single PersistentVolume @@ -149,7 +149,7 @@ PersistentVolume Claims. Note that, the PersistentVolumes associated with the Pods' PersistentVolume Claims are not deleted when the Pods, or StatefulSet are deleted. This must be done manually. -### Deployment and Scaling Guarantee +## Deployment and Scaling Guarantee * For a StatefulSet with N replicas, when Pods are being deployed, they are created sequentially, in order from {0..N-1}. * When Pods are being deleted, they are terminated in reverse order, from {N-1..0}. diff --git a/docs/concepts/abstractions/overview.md b/docs/concepts/abstractions/overview.md index ffed154293..dc2e8cf7ab 100644 --- a/docs/concepts/abstractions/overview.md +++ b/docs/concepts/abstractions/overview.md @@ -7,7 +7,7 @@ This page explains how Kubernetes objects are represented in the Kubernetes API, {% endcapture %} {% capture body %} -### Understanding Kubernetes Objects +## Understanding Kubernetes Objects *Kubernetes Objects* are persistent entities in the Kubernetes system. Kubenetes uses these entities to represent the state of your cluster. Specifically, they can describe: @@ -19,7 +19,7 @@ A Kubernetes object is a "record of intent"--once you create the object, the Kub To work with Kubernetes objects--whether to create, modify, or delete them--you'll need to use the [Kubernetes API](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/api-conventions.md). When you use the `kubectl` comamnd-line interface, for example, the CLI makes the necessary Kubernetes API calls for you; you can also use the Kubernetes API directly in your own programs. Kubernetes currently provides a `golang` [client library](https://github.com/kubernetes/client-go) for this purpose, and other language libraries (such as [Python](https://github.com/kubernetes-incubator/client-python)) are being developed. -#### Object Spec and Status +### Object Spec and Status Every Kubernetes object includes two nested object fields that govern the object's configuration: the object *spec* and the object *status*. The *spec*, which you must provide, describes your *desired state* for the object--the characteristics that you want the object to have. The *status* describes the *actual state* for the object, and is supplied and updated by the Kubernetes system. At any given time, the Kubernetes Control Plane actively manages an object's actual state to match the desired state you supplied. @@ -27,7 +27,7 @@ For example, a Kubernetes Deployment is an object that can represent an applicat For more information on the object spec, status, and metadata, see the [Kubernetes API Conventions](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/api-conventions.md#spec-and-status). -#### Describing a Kubernetes Object +### Describing a Kubernetes Object When you create an object in Kubernetes, you must provide the object spec that describes its desired state, as well as some basic information about the object (such as a name). When you use the Kubernetes API to create the object (either directly or via `kubectl`), that API request must include that information as JSON in the request body. **Most often, you provide the information to `kubectl` in a .yaml file.** `kubectl` converts the information to JSON when making the API request. @@ -47,7 +47,7 @@ The output is similar to this: deployment "nginx-deployment" created ``` -#### Required Fields +### Required Fields In the `.yaml` file for the Kubernetes object you want to create, you'll need to set values for the following fields: @@ -63,4 +63,4 @@ You'll also need to provide the object `spec` field. The precise format of the o * Learn about the most important basic Kubernetes objects, such as [Pod](/docs/concepts/abstractions/pod/). {% endcapture %} -{% include templates/concept.md %} \ No newline at end of file +{% include templates/concept.md %} diff --git a/docs/concepts/abstractions/pod.md b/docs/concepts/abstractions/pod.md index 82d6407a8e..33637168db 100644 --- a/docs/concepts/abstractions/pod.md +++ b/docs/concepts/abstractions/pod.md @@ -9,7 +9,7 @@ This page provides an overview of `Pod`, the smallest deployable object in the K {:toc} {% capture body %} -### Understanding Pods +## Understanding Pods A *Pod* is the basic building block of Kubernetes--the smallest and simplest unit in the Kubernetes object model that you create or deploy. A Pod represents a running process on your cluster. @@ -29,7 +29,7 @@ The [Kubernetes Blog](http://blog.kubernetes.io) has some additional information Each Pod is meant to run a single instance of a given application. If you want to scale your application horizontally (e.g., run muliple instances), you should use multiple Pods, one for each instance. In Kubernetes, this is generally referred to as _replication_. Replicated Pods are usually created and managed as a group by an abstraction called a Controller. See [Pods and Controllers](#pods-and-controllers) for more information. -#### How Pods Manage Multiple Containers +### How Pods Manage Multiple Containers Pods are designed to support multiple cooperating processes (as containers) that form a cohesive unit of service. The containers in a Pod are automatically co-located and co-scheduled on the same phyiscal or virtual machine in the cluster. The containers can share resources and dependencies, communicate with one another, and coordinate when and how they are terminated. @@ -39,15 +39,15 @@ Note that grouping multiple co-located and co-managed containers in a single Pod Pods provide two kinds of shared resources for their constituent containers: *networking* and *storage*. -##### Networking +#### Networking Each Pod is assigned a unique IP address. Every the container in a Pod shares the network namespace, including the IP address and network ports. Containers *inside a Pod* can communicate with one another using `localhost`. When containers in a Pod communicate with entities *outside the Pod*, they must coordinate how they use the shared network resources (such as ports). -##### Storage +#### Storage A Pod can specify a set of shared storage *volumes*. All containers in the Pod can access the shared volumes, allowing those containers to share data. Volumes also allow persistent data in a Pod to survive in case one of the containers within needs to be restarted. See Volumes for more information on how Kubernetes implements shared storage in a Pod. -### Working with Pods +## Working with Pods You'll rarely create individual Pods directly in Kubernetes--even singleton Pods. This is because Pods are designed as relatively ephemeral, disposable entities. When a Pod gets created (directly by you, or indirectly by a Controller), it is scheduled to run on a Node in your your cluster. The Pod remains on that Node until the process is terminated, the pod object is deleted, or the pod is *evicted* for lack of resources, or the Node fails. @@ -55,7 +55,7 @@ You'll rarely create individual Pods directly in Kubernetes--even singleton Pods Pods do not, by themselves, self-heal. If a Pod is scheduled to a Node that fails, or if the scheduling operation itself fails, the Pod is deleted; likewise, a Pod won't survive an eviction due to a lack of resources or Node maintenance. Kubernetes uses a higher-level abstraction, called a *Controller*, that handles the work of managing the relatively disposable Pod instances. Thus, while it is possible to use Pod directly, it's far more common in Kubernetes to manage your pods using a Controller. See [Pods and Controllers](#pods-and-controllers) for more information on how Kubernetes uses Controllers to implement Pod scaling and healing. -#### Pods and Controllers +### Pods and Controllers A Controller can create and manage multiple Pods for you, handling replication and rollout and providing self-healing capabilities at cluster scope. For example, if a Node fails, the Controller might automatically replace the Pod by scheduling an identical replacement on a different Node). @@ -75,4 +75,4 @@ In general, Controllers use a Pod Template that you provide to create the Pods f * Other Pod Topics {% endcapture %} -{% include templates/concept.md %} \ No newline at end of file +{% include templates/concept.md %} diff --git a/docs/concepts/object-metadata/annotations.md b/docs/concepts/object-metadata/annotations.md index fbf73f48fd..00840db613 100644 --- a/docs/concepts/object-metadata/annotations.md +++ b/docs/concepts/object-metadata/annotations.md @@ -8,7 +8,7 @@ to objects. Clients such as tools and libraries can retrieve this metadata. {% endcapture %} {% capture body %} -### Attaching metadata to objects +## Attaching metadata to objects You can use either labels or annotations to attach metadata to Kubernetes objects. Labels can be used to select objects and to find diff --git a/docs/tasks/access-application-cluster/load-balance-access-application-cluster.md b/docs/tasks/access-application-cluster/load-balance-access-application-cluster.md index c42d97e3e9..f6cb1251fe 100644 --- a/docs/tasks/access-application-cluster/load-balance-access-application-cluster.md +++ b/docs/tasks/access-application-cluster/load-balance-access-application-cluster.md @@ -28,7 +28,7 @@ load-balanced access to an application running in a cluster. {% capture lessoncontent %} -### Creating a Service for an application running in two pods +## Creating a Service for an application running in two pods 1. Run a Hello World application in your cluster: @@ -98,7 +98,7 @@ load-balanced access to an application running in a cluster. where `` us the IP address of your Minikube node, and `` is the NodePort value for your service. -### Using a service configuration file +## Using a service configuration file As an alternative to using `kubectl expose`, you can use a [service configuration file](/docs/user-guide/services/operations) @@ -108,15 +108,6 @@ to create a Service. {% endcapture %} -{% capture cleanup %} - -If you want to stop the Hello World application, enter these commands: - - TODO - -{% endcapture %} - - {% capture whatsnext %} Learn more about diff --git a/docs/tasks/access-application-cluster/port-forward-access-application-cluster.md b/docs/tasks/access-application-cluster/port-forward-access-application-cluster.md index 4b0acb8f88..f3fe10161e 100644 --- a/docs/tasks/access-application-cluster/port-forward-access-application-cluster.md +++ b/docs/tasks/access-application-cluster/port-forward-access-application-cluster.md @@ -22,7 +22,7 @@ for database debugging. {% capture steps %} -### Creating a pod to run a Redis server +## Creating a pod to run a Redis server 1. Create a pod: @@ -51,7 +51,7 @@ for database debugging. 6379 -### Forward a local port to a port on the pod +## Forward a local port to a port on the pod 1. Forward port 6379 on the local workstation to port 6379 of redis-master pod: @@ -77,7 +77,7 @@ for database debugging. {% capture discussion %} -### Discussion +## Discussion Connections made to local port 6379 are forwarded to port 6379 of the pod that is running the Redis server. With this connection in place you can use your diff --git a/docs/tasks/access-kubernetes-api/http-proxy-access-api.md b/docs/tasks/access-kubernetes-api/http-proxy-access-api.md index 9dee7c9c4d..92baf97aa9 100644 --- a/docs/tasks/access-kubernetes-api/http-proxy-access-api.md +++ b/docs/tasks/access-kubernetes-api/http-proxy-access-api.md @@ -19,13 +19,13 @@ This page shows how to use an HTTP proxy to access the Kubernetes API. {% capture steps %} -### Using kubectl to start a proxy server +## Using kubectl to start a proxy server This command starts a proxy to the Kubernetes API server: kubectl proxy --port=8080 -### Exploring the Kubernetes API +## Exploring the Kubernetes API When the proxy server is running, you can explore the API using `curl`, `wget`, or a browser. diff --git a/docs/tasks/administer-cluster/assign-pods-nodes.md b/docs/tasks/administer-cluster/assign-pods-nodes.md index 03dc0c021c..43db077f76 100644 --- a/docs/tasks/administer-cluster/assign-pods-nodes.md +++ b/docs/tasks/administer-cluster/assign-pods-nodes.md @@ -15,7 +15,7 @@ Kubernetes cluster. {% capture steps %} -### Adding a label to a node +## Adding a label to a node 1. List the nodes in your cluster: @@ -49,7 +49,7 @@ Kubernetes cluster. In the preceding output, you can see that the `worker0` node has a `disktype=ssd` label. -### Creating a pod that gets scheduled to your chosen node +## Creating a pod that gets scheduled to your chosen node This pod configuration file describes a pod that has a node selector, `disktype: ssd`. This means that the pod will get scheduled on a node that has diff --git a/docs/tasks/administer-cluster/change-pv-reclaim-policy.md b/docs/tasks/administer-cluster/change-pv-reclaim-policy.md index 0e70c0c709..08a18f8f08 100644 --- a/docs/tasks/administer-cluster/change-pv-reclaim-policy.md +++ b/docs/tasks/administer-cluster/change-pv-reclaim-policy.md @@ -15,7 +15,7 @@ PersistentVolume. {% capture steps %} -### Why change reclaim policy of a PersistentVolume +## Why change reclaim policy of a PersistentVolume `PersistentVolumes` can have various reclaim policies, including "Retain", "Recycle", and "Delete". For dynamically provisioned `PersistentVolumes`, @@ -27,7 +27,7 @@ policy. With the "Retain" policy, if a user deletes a `PeristentVolumeClaim`, the corresponding `PersistentVolume` is not be deleted. Instead, it is moved to the `Released` phase, where all of its data can be manually recovered. -### Changing the reclaim policy of a PersistentVolume +## Changing the reclaim policy of a PersistentVolume 1. List the PersistentVolumes in your cluster: @@ -70,7 +70,7 @@ the corresponding `PersistentVolume` is not be deleted. Instead, it is moved to * Learn more about [PersistentVolumes](/docs/user-guide/persistent-volumes/). * Learn more about [PersistentVolumeClaims](/docs/user-guide/persistent-volumes/#persistentvolumeclaims). -#### Reference +### Reference * [PersistentVolume](/docs/api-reference/v1/definitions/#_v1_persistentvolume) * [PersistentVolumeClaim](/docs/api-reference/v1/definitions/#_v1_persistentvolumeclaim) diff --git a/docs/tasks/administer-cluster/dns-horizontal-autoscaling.md b/docs/tasks/administer-cluster/dns-horizontal-autoscaling.md index fa8202865d..069409058a 100644 --- a/docs/tasks/administer-cluster/dns-horizontal-autoscaling.md +++ b/docs/tasks/administer-cluster/dns-horizontal-autoscaling.md @@ -19,7 +19,7 @@ Kubernetes cluster. {% capture steps %} -### Determining whether DNS horizontal autoscaling is already enabled +## Determining whether DNS horizontal autoscaling is already enabled List the Deployments in your cluster in the kube-system namespace: @@ -36,7 +36,7 @@ If you see "kube-dns-autoscaler" in the output, DNS horizontal autoscaling is already enabled, and you can skip to [Tuning autoscaling parameters](#tuning-autoscaling-parameters). -### Getting the name of your DNS Deployment or ReplicationController +## Getting the name of your DNS Deployment or ReplicationController List the Deployments in your cluster in the kube-system namespace: @@ -63,7 +63,7 @@ The output is similar to this: kube-dns-v20 1 1 1 ... ... -### Determining your scale target +## Determining your scale target If you have a DNS Deployment, your scale target is: @@ -80,7 +80,7 @@ where is the name of your DNS ReplicationController. For example, if your DNS ReplicationController name is kube-dns-v20, your scale target is ReplicationController/kube-dns-v20. -### Enabling DNS horizontal autoscaling +## Enabling DNS horizontal autoscaling In this section, you create a Deployment. The Pods in the Deployment run a container based on the `cluster-proportional-autoscaler-amd64` image. @@ -102,7 +102,7 @@ The output of a successful command is: DNS horizontal autoscaling is now enabled. -### Tuning autoscaling parameters +## Tuning autoscaling parameters Verify that the kube-dns-autoscaler ConfigMap exists: @@ -139,12 +139,12 @@ cores, `nodesPerReplica` dominates. There are other supported scaling patterns. For details, see [cluster-proportional-autoscaler](https://github.com/kubernetes-incubator/cluster-proportional-autoscaler). -### Disable DNS horizontal autoscaling +## Disable DNS horizontal autoscaling There are a few options for turning DNS horizontal autoscaling. Which option to use depends on different conditions. -#### Option 1: Scale down the kube-dns-autoscaler deployment to 0 replicas +### Option 1: Scale down the kube-dns-autoscaler deployment to 0 replicas This option works for all situations. Enter this command: @@ -165,7 +165,7 @@ The output displays 0 in the DESIRED and CURRENT columns: kube-dns-autoscaler 0 0 0 0 ... ... -#### Option 2: Delete the kube-dns-autoscaler deployment +### Option 2: Delete the kube-dns-autoscaler deployment This option works if kube-dns-autoscaler is under your own control, which means no one will re-create it: @@ -176,7 +176,7 @@ The output is: deployment "kube-dns-autoscaler" deleted -#### Option 3: Delete the kube-dns-autoscaler manifest file from the master node +### Option 3: Delete the kube-dns-autoscaler manifest file from the master node This option works if kube-dns-autoscaler is under control of the [Addon Manager](https://github.com/kubernetes/kubernetes/blob/master/cluster/addons/README.md)'s @@ -194,7 +194,7 @@ kube-dns-autoscaler Deployment. {% capture discussion %} -### Understanding how DNS horizontal autoscaling works +## Understanding how DNS horizontal autoscaling works * The cluster-proportional-autoscaler application is deployed separately from the DNS service. @@ -215,7 +215,7 @@ the autoscaler Pod. * The autoscaler provides a controller interface to support two control patterns: *linear* and *ladder*. -### Future enhancements +## Future enhancements Control patterns, in addition to linear and ladder, that consider custom metrics are under consideration as a future development. diff --git a/docs/tasks/administer-cluster/safely-drain-node.md b/docs/tasks/administer-cluster/safely-drain-node.md index 902d9b1db3..d69bcb2363 100644 --- a/docs/tasks/administer-cluster/safely-drain-node.md +++ b/docs/tasks/administer-cluster/safely-drain-node.md @@ -21,7 +21,7 @@ application-level disruption SLOs you want the system to enforce. {% capture steps %} -### Use `kubectl drain` to remove a node from service +## Use `kubectl drain` to remove a node from service You can use `kubectl drain` to safely evict all of your pods from a node before you perform maintenance on the node (e.g. kernel upgrade, @@ -64,7 +64,7 @@ kubectl uncordon ``` afterwards to tell Kubernetes that it can resume scheduling new pods onto the node. -### Draining multiple nodes in parallel +## Draining multiple nodes in parallel The `kubectl drain` command should only be issued to a single node at a time. However, you can run multiple `kubectl drain` commands for diff --git a/docs/tasks/configure-pod-container/assign-cpu-ram-container.md b/docs/tasks/configure-pod-container/assign-cpu-ram-container.md index 8722499c34..24cca3eca5 100644 --- a/docs/tasks/configure-pod-container/assign-cpu-ram-container.md +++ b/docs/tasks/configure-pod-container/assign-cpu-ram-container.md @@ -19,7 +19,7 @@ in a Kubernetes Pod. {% capture steps %} -### Assigning CPU and RAM resources to a container +## Assigning CPU and RAM resources to a container When you create a Pod, you can request CPU and RAM resources for the containers that run in the Pod. You can also set limits for CPU and RAM resources. To @@ -64,7 +64,7 @@ for the `Pod`: cpu: 250m memory: 64Mi -### Understanding CPU and RAM units +## Understanding CPU and RAM units The CPU resource is measured in *cpu*s. Fractional values are allowed. You can use the suffix *m* to mean mili. For example 100m cpu is 100 milicpu, and is @@ -89,7 +89,7 @@ If you specify a request, a Pod is guaranteed to be able to use that much of the resource. See [Resource QoS](https://github.com/kubernetes/kubernetes/blob/{{page.githubbranch}}/docs/design/resource-qos.md) for the difference between resource limits and requests. -### If you don't specify limits or requests +## If you don't specify limits or requests If you don't specify a RAM limit, Kubernetes places no upper bound on the amount of RAM a Container can use. A Container could use all the RAM 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 715ea3effb..a46f910714 100644 --- a/docs/tasks/configure-pod-container/attach-handler-lifecycle-event.md +++ b/docs/tasks/configure-pod-container/attach-handler-lifecycle-event.md @@ -21,7 +21,7 @@ Container is terminated. {% capture steps %} -### Defining postStart and preStop handlers +## 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. @@ -60,7 +60,7 @@ The output shows the text written by the postStart handler: {% capture discussion %} -### 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 @@ -83,7 +83,7 @@ unless the Pod's grace period expires. For more details, see * 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) diff --git a/docs/tasks/configure-pod-container/communicate-containers-same-pod.md b/docs/tasks/configure-pod-container/communicate-containers-same-pod.md index 0f934dc085..815ee8dc19 100644 --- a/docs/tasks/configure-pod-container/communicate-containers-same-pod.md +++ b/docs/tasks/configure-pod-container/communicate-containers-same-pod.md @@ -19,7 +19,7 @@ in the same Pod. {% capture steps %} -### Creating a Pod that runs two Containers +## Creating a Pod that runs two Containers In this exercise, you create a Pod that runs two Containers. The two containers share a Volume that they can use to communicate. Here is the configuration file @@ -111,7 +111,7 @@ The output shows that nginx serves a web page written by the debian container: {% capture discussion %} -### Discussion +## Discussion The primary reason that Pods can have multiple containers is to support helper applications that assist a primary application. Typical examples of diff --git a/docs/tasks/configure-pod-container/configure-liveness-readiness-probes.md b/docs/tasks/configure-pod-container/configure-liveness-readiness-probes.md index 3b7f7462ef..8c877ac16c 100644 --- a/docs/tasks/configure-pod-container/configure-liveness-readiness-probes.md +++ b/docs/tasks/configure-pod-container/configure-liveness-readiness-probes.md @@ -30,7 +30,7 @@ When a Pod is not ready, it is removed from Service load balancers. {% capture steps %} -### Defining a liveness command +## Defining a liveness command Many applications running for long periods of time eventually transition to broken states, and cannot recover except by being restarted. Kubernetes provides @@ -117,7 +117,7 @@ NAME READY STATUS RESTARTS AGE liveness-exec 1/1 Running 1 1m ``` -### Defining a liveness HTTP request +## Defining a liveness HTTP request Another kind of liveness probe uses an HTTP GET request. Here is the configuration file for a Pod that runs a container based on the `gcr.io/google_containers/liveness` @@ -173,7 +173,7 @@ the Container has been restarted: kubectl describe pod liveness-http ``` -### Using a named port +## Using a named port You can use a named [ContainerPort](/docs/api-reference/v1/definitions/#_v1_containerport) @@ -191,7 +191,7 @@ livenessProbe: port: liveness-port ``` -### Defining readiness probes +## Defining readiness probes Sometimes, applications are temporarily unable to serve traffic. For example, an application might need to load large data or configuration @@ -219,7 +219,7 @@ readinessProbe: {% capture discussion %} -### Discussion +## Discussion {% comment %} Eventually, some of this Discussion section could be moved to a concept topic. @@ -260,7 +260,7 @@ In addition to command probes and HTTP probes, Kubenetes supports * Learn more about [Health Checking section](/docs/user-guide/walkthrough/k8s201/#health-checking). -#### Reference +### Reference * [Pod](http://kubernetes.io/docs/api-reference/v1/definitions#_v1_pod) * [Container](/docs/api-reference/v1/definitions/#_v1_container) diff --git a/docs/tasks/configure-pod-container/configure-pod-initialization.md b/docs/tasks/configure-pod-container/configure-pod-initialization.md index add65b09ee..7aa2bff40a 100644 --- a/docs/tasks/configure-pod-container/configure-pod-initialization.md +++ b/docs/tasks/configure-pod-container/configure-pod-initialization.md @@ -16,7 +16,7 @@ application Container runs. {% capture steps %} -### Creating a Pod that has an init Container +## Creating a Pod that has an init Container In this exercise you create a Pod that has one application Container and one init Container. The init Container runs to completion before the application diff --git a/docs/tasks/configure-pod-container/configure-volume-storage.md b/docs/tasks/configure-pod-container/configure-volume-storage.md index 6919a91fb0..92756615a8 100644 --- a/docs/tasks/configure-pod-container/configure-volume-storage.md +++ b/docs/tasks/configure-pod-container/configure-volume-storage.md @@ -23,7 +23,7 @@ key-value cache and store. {% capture steps %} -### Configuring a volume for a Pod +## Configuring a volume for a Pod In this exercise, you create a Pod that runs one Container. This Pod has a Volume of type diff --git a/docs/tasks/configure-pod-container/define-command-argument-container.md b/docs/tasks/configure-pod-container/define-command-argument-container.md index 4fd988744d..df4350aa1a 100644 --- a/docs/tasks/configure-pod-container/define-command-argument-container.md +++ b/docs/tasks/configure-pod-container/define-command-argument-container.md @@ -19,7 +19,7 @@ in a Kubernetes Pod. {% capture steps %} -### Defining a command and arguments when you create a Pod +## Defining a command and arguments when you create a Pod When you create a Pod, you can define a command and arguments for the containers that run in the Pod. To define a command, include the `command` @@ -60,7 +60,7 @@ from the Pod: command-demo tcp://10.3.240.1:443 -### Using environment variables to define arguments +## Using environment variables to define arguments In the preceding example, you defined the arguments directly by providing strings. As an alternative to providing strings directly, @@ -81,7 +81,7 @@ and NOTE: The environment variable appears in parentheses, `"$(VAR)"`. This is required for the variable to be expanded in the `command` or `args` field. -### Running a command in a shell +## Running a command in a shell In some cases, you need your command to run in a shell. For example, your command might consist of several commands piped together, or it might be a shell diff --git a/docs/tasks/configure-pod-container/define-environment-variable-container.md b/docs/tasks/configure-pod-container/define-environment-variable-container.md index f24f1bcc8a..7faba40522 100644 --- a/docs/tasks/configure-pod-container/define-environment-variable-container.md +++ b/docs/tasks/configure-pod-container/define-environment-variable-container.md @@ -19,7 +19,7 @@ in a Kubernetes Pod. {% capture steps %} -### Defining an environment variable for a container +## Defining an environment variable for a container When you create a Pod, you can set environment variables for the containers that run in the Pod. To set environment variables, include the `env` field in diff --git a/docs/tasks/configure-pod-container/distribute-credentials-secure.md b/docs/tasks/configure-pod-container/distribute-credentials-secure.md index 48272a7cba..69d5d37890 100644 --- a/docs/tasks/configure-pod-container/distribute-credentials-secure.md +++ b/docs/tasks/configure-pod-container/distribute-credentials-secure.md @@ -15,7 +15,7 @@ encryption keys, into Pods. {% capture steps %} -### Converting your secret data to a base-64 representation +## Converting your secret data to a base-64 representation Suppose you want to have two pieces of secret data: a username `my-app` and a password `39528$vdg7Jb`. First, use [Base64 encoding](https://www.base64encode.org/) to @@ -28,7 +28,7 @@ example: The output shows that the base-64 representation of your username is `bXktYXBwCg==`, and the base-64 representation of your password is `Mzk1MjgkdmRnN0piCg==`. -### Creating a Secret +## Creating a Secret Here is a configuration file you can use to create a Secret that holds your username and password: @@ -72,7 +72,7 @@ username and password: password: 13 bytes username: 7 bytes -### Creating a Pod that has access to the secret data through a Volume +## Creating a Pod that has access to the secret data through a Volume Here is a configuration file you can use to create a Pod: @@ -119,7 +119,7 @@ is exposed: my-app 39528$vdg7Jb -### Creating a Pod that has access to the secret data through environment variables +## Creating a Pod that has access to the secret data through environment variables Here is a configuration file you can use to create a Pod: @@ -160,7 +160,7 @@ Here is a configuration file you can use to create a Pod: * Learn more about [Secrets](/docs/user-guide/secrets/). * Learn about [Volumes](/docs/user-guide/volumes/). -#### Reference +### Reference * [Secret](docs/api-reference/v1/definitions/#_v1_secret) * [Volume](docs/api-reference/v1/definitions/#_v1_volume) diff --git a/docs/tasks/configure-pod-container/pull-image-private-registry.md b/docs/tasks/configure-pod-container/pull-image-private-registry.md index 5560dd9a30..e9b640873a 100644 --- a/docs/tasks/configure-pod-container/pull-image-private-registry.md +++ b/docs/tasks/configure-pod-container/pull-image-private-registry.md @@ -20,7 +20,7 @@ private Docker registry or repository. {% capture steps %} -### Logging in to Docker +## Logging in to Docker docker login @@ -43,7 +43,7 @@ The output contains a section similar to this: } } -### Creating a Secret that holds your authorization token +## Creating a Secret that holds your authorization token Create a Secret named `regsecret`: @@ -55,7 +55,7 @@ where: * `` is your Docker password. * `` is your Docker email. -### Understanding your Secret +## Understanding your Secret To understand what's in the Secret you just created, start by viewing the Secret in YAML format: @@ -92,7 +92,7 @@ The output is similar to this: Notice that the secret data contains the authorization token from your `config.json` file. -### Creating a Pod that uses your Secret +## Creating a Pod that uses your Secret Here is a configuration file for a Pod that needs access to your secret data: diff --git a/docs/tasks/debug-application-cluster/determine-reason-pod-failure.md b/docs/tasks/debug-application-cluster/determine-reason-pod-failure.md index 3f1c5fbc89..3a0e79898a 100644 --- a/docs/tasks/debug-application-cluster/determine-reason-pod-failure.md +++ b/docs/tasks/debug-application-cluster/determine-reason-pod-failure.md @@ -27,7 +27,7 @@ the general {% capture steps %} -### Writing and reading a termination message +## Writing and reading a termination message In this exercise, you create a Pod that runs one container. The configuration file specifies a command that runs when @@ -75,7 +75,7 @@ only the termination message: {% raw %} kubectl get pod termination-demo -o go-template="{{range .status.containerStatuses}}{{.lastState.terminated.message}}{{end}}"{% endraw %} ``` -### Setting the termination log file +## Setting the termination log file By default Kubernetes retrieves termination messages from `/dev/termination-log`. To change this to a different file, diff --git a/docs/tasks/manage-stateful-set/debugging-a-statefulset.md b/docs/tasks/manage-stateful-set/debugging-a-statefulset.md index 2266d7a323..f66a8a1c53 100644 --- a/docs/tasks/manage-stateful-set/debugging-a-statefulset.md +++ b/docs/tasks/manage-stateful-set/debugging-a-statefulset.md @@ -26,7 +26,7 @@ This task shows you how to debug a StatefulSet. {% capture steps %} -### Debugging a StatefulSet +## Debugging a StatefulSet In order to list all the pods which belong to a StatefulSet, which have a label `app=myapp` set on them, you can use the following: @@ -44,7 +44,7 @@ kubectl annotate pods pod.alpha.kubernetes.io/initialized="false" --o When the annotation is set to `"false"`, the StatefulSet will not respond to its Pods becoming unhealthy or unavailable. It will not create replacement Pods till the annotation is removed or set to `"true"` on each StatefulSet Pod. -#### Step-wise Initialization +### Step-wise Initialization You can also use the same annotation to debug race conditions during bootstrapping of the StatefulSet by setting the `pod.alpha.kubernetes.io/initialized` annotation to `"false"` in the `.spec.template.metadata.annotations` field of the StatefulSet prior to creating it. diff --git a/docs/tasks/manage-stateful-set/delete-pods.md b/docs/tasks/manage-stateful-set/delete-pods.md index 4b31def936..d1b66ce881 100644 --- a/docs/tasks/manage-stateful-set/delete-pods.md +++ b/docs/tasks/manage-stateful-set/delete-pods.md @@ -21,13 +21,13 @@ This page shows how to delete Pods which are part of a stateful set, and explain {% capture steps %} -### StatefulSet considerations +## StatefulSet considerations In normal operation of a StatefulSet, there is **never** a need to force delete a StatefulSet Pod. The StatefulSet controller is responsible for creating, scaling and deleting members of the StatefulSet. It tries to ensure that the specified number of Pods from ordinal 0 through N-1 are alive and ready. StatefulSet ensures that, at any time, there is at most one Pod with a given identity running in a cluster. This is referred to as *at most one* semantics provided by a StatefulSet. Manual force deletion should be undertaken with caution, as it has the potential to violate the at most one semantics inherent to StatefulSet. StatefulSets may be used to run distributed and clustered applications which have a need for a stable network identity and stable storage. These applications often have configuration which relies on an ensemble of a fixed number of members with fixed identities. Having multiple members with the same identity can be disastrous and may lead to data loss (e.g. split brain scenario in quorum-based systems). -### Deleting Pods +## Deleting Pods You can perform a graceful pod deletion with the following command: @@ -46,7 +46,7 @@ The recommended best practice is to use the first or second approach. If a Node Normally, the system completes the deletion once the Pod is no longer running on a Node, or the Node is deleted by an administrator. You may override this by force deleting the Pod. -#### Force Deletion +### Force Deletion Force deletions **do not** wait for confirmation from the kubelet that the Pod has been terminated. Irrespective of whether a force deletion is successful in killing a Pod, it will immediately free up the name from the apiserver. This would let the StatefulSet controller create a replacement Pod with that same identity; this can lead to the duplication of a still-running Pod, and if said Pod can still communicate with the other members of the StatefulSet, will violate the at most one semantics that StatefulSet is designed to guarantee. diff --git a/docs/tasks/manage-stateful-set/deleting-a-statefulset.md b/docs/tasks/manage-stateful-set/deleting-a-statefulset.md index 5ea82aef04..76cc87dcf0 100644 --- a/docs/tasks/manage-stateful-set/deleting-a-statefulset.md +++ b/docs/tasks/manage-stateful-set/deleting-a-statefulset.md @@ -22,7 +22,7 @@ This task shows you how to delete a StatefulSet. {% capture steps %} -### Deleting a StatefulSet +## Deleting a StatefulSet You can delete a StatefulSet in the same way you delete other resources in Kubernetes: use the `kubectl delete` command, and specify the StatefulSet either by file or by name. @@ -52,13 +52,13 @@ By passing `--cascade=false` to `kubectl delete`, the Pods managed by the Statef kubectl delete pods -l app=myapp ``` -#### Persistent Volumes +### Persistent Volumes Deleting the Pods in a StatefulSet will not delete the associated volumes. This is to ensure that you have the chance to copy data off the volume before deleting it. Deleting the PVC after the pods have left the [terminating state](/docs/user-guide/pods/index#termination-of-pods) might trigger deletion of the backing Persistent Volumes depending on the storage class and reclaim policy. You should never assume ability to access a volume after claim deletion. **Note: Use caution when deleting a PVC, as it may lead to data loss.** -#### Complete deletion of a StatefulSet +### Complete deletion of a StatefulSet To simply delete everything in a StatefulSet, including the associated pods, you can run a series of commands similar to the following: @@ -72,7 +72,7 @@ kubectl delete pvc -l app=myapp In the example above, the Pods have the label `app=myapp`; substitute your own label as appropriate. -#### Force deletion of StatefulSet pods +### Force deletion of StatefulSet pods If you find that some pods in your StatefulSet are stuck in the 'Terminating' or 'Unknown' states for an extended period of time, you may need to manually intervene to forcefully delete the pods from the apiserver. This is a potentially dangerous task. Refer to [Deleting StatefulSet Pods](/docs/tasks/manage-stateful-set/delete-pods/) for details. diff --git a/docs/tasks/manage-stateful-set/scale-stateful-set.md b/docs/tasks/manage-stateful-set/scale-stateful-set.md index d00fbc055b..eda728efdd 100644 --- a/docs/tasks/manage-stateful-set/scale-stateful-set.md +++ b/docs/tasks/manage-stateful-set/scale-stateful-set.md @@ -25,13 +25,13 @@ This page shows how to scale a StatefulSet. {% capture steps %} -### Use `kubectl` to scale StatefulSets +## Use `kubectl` to scale StatefulSets Make sure you have `kubectl` upgraded to Kubernetes version 1.5 or later before continuing. If you're unsure, run `kubectl version` and check `Client Version` for which kubectl you're using. -#### `kubectl scale` +### `kubectl scale` First, find the StatefulSet you want to scale. Remember, you need to first understand if you can scale it or not. @@ -45,7 +45,7 @@ Change the number of replicas of your StatefulSet: kubectl scale statefulsets --replicas= ``` -#### Alternative: `kubectl apply` / `kubectl edit` / `kubectl patch` +### Alternative: `kubectl apply` / `kubectl edit` / `kubectl patch` Alternatively, you can do [in-place updates](/docs/user-guide/managing-deployments/#in-place-updates-of-resources) on your StatefulSets. @@ -68,9 +68,9 @@ Or use `kubectl patch`: kubectl patch statefulsets -p '{"spec":{"replicas":}}' ``` -### Troubleshooting +## Troubleshooting -#### Scaling down doesn't not work right +### Scaling down doesn't not work right You cannot scale down a StatefulSet when any of the stateful Pods it manages is unhealthy. Scaling down only takes place after those stateful Pods become running and ready. diff --git a/docs/tasks/manage-stateful-set/upgrade-pet-set-to-stateful-set.md b/docs/tasks/manage-stateful-set/upgrade-pet-set-to-stateful-set.md index 592d07f833..57852bd1cc 100644 --- a/docs/tasks/manage-stateful-set/upgrade-pet-set-to-stateful-set.md +++ b/docs/tasks/manage-stateful-set/upgrade-pet-set-to-stateful-set.md @@ -23,7 +23,7 @@ This page shows how to upgrade from PetSets (Kubernetes version 1.3 or 1.4) to * {% capture steps %} -### Differences between alpha PetSets and beta StatefulSets +## Differences between alpha PetSets and beta StatefulSets PetSet was introduced as an alpha resource in Kubernetes release 1.3, and was renamed to StatefulSet as a beta resource in 1.5. Here are some notable changes: @@ -33,13 +33,13 @@ Here are some notable changes: * **Flipped debug annotation behavior**: The default value of the debug annotation (`pod.alpha.kubernetes.io/initialized`) is now `true`. The absence of this annotation will pause PetSet operations, but will NOT pause StatefulSet operations. In most cases, you no longer need this annotation in your StatefulSet manifests. -### Upgrading from PetSets to StatefulSets +## Upgrading from PetSets to StatefulSets Note that these steps need to be done in the specified order. You **should NOT upgrade your Kubernetes master, nodes, or `kubectl` to Kubernetes version 1.5 or later**, until told to do so. -#### Find all PetSets and their manifests +### Find all PetSets and their manifests First, find all existing PetSets in your cluster: @@ -60,7 +60,7 @@ Here's an example command for you to save all existing PetSets as one file. kubectl get petsets --all-namespaces -o yaml > all-petsets.yaml ``` -#### Prepare StatefulSet manifests +### Prepare StatefulSet manifests Now, for every PetSet manifest you have, prepare a corresponding StatefulSet manifest: @@ -71,7 +71,7 @@ Now, for every PetSet manifest you have, prepare a corresponding StatefulSet man It's recommended that you keep both PetSet manifests and StatefulSet manifests, so that you can safely roll back and recreate your PetSets, if you decide not to upgrade your cluster. -#### Delete all PetSets without cascading +### Delete all PetSets without cascading If you find existing PetSets in your cluster in the previous step, you need to delete all PetSets *without cascading*. You can do this from `kubectl` with `--cascade=false`. Note that if the flag isn't set, **cascading deletion will be performed by default**, and all Pods managed by your PetSets will be gone. @@ -103,18 +103,18 @@ kubectl get petsets --all-namespaces At this moment, you've deleted all PetSets in your cluster, but not their Pods, Persistent Volumes, or Persistent Volume Claims. However, since the Pods are not managed by PetSets anymore, they will be vulnerable to node failures until you finish the master upgrade and recreate StatefulSets. -#### Upgrade your master to Kubernetes version 1.5 or later +### Upgrade your master to Kubernetes version 1.5 or later Now, you can [upgrade your Kubernetes master](/docs/admin/cluster-management/#upgrading-a-cluster) to Kubernetes version 1.5 or later. Note that **you should NOT upgrade Nodes at this time**, because the Pods (that were once managed by PetSets) are now vulnerable to node failures. -#### Upgrade kubectl to Kubernetes version 1.5 or later +### Upgrade kubectl to Kubernetes version 1.5 or later Upgrade `kubectl` to Kubernetes version 1.5 or later, following [the steps for installing and setting up kubectl](/docs/user-guide/prereqs/). -#### Create StatefulSets +### Create StatefulSets Make sure you have both master and `kubectl` upgraded to Kubernetes version 1.5 or later before continuing: @@ -147,7 +147,7 @@ newly-upgraded cluster: kubectl get statefulsets --all-namespaces ``` -#### Upgrade nodes to Kubernetes version 1.5 or later (optional) +### Upgrade nodes to Kubernetes version 1.5 or later (optional) You can now [upgrade Kubernetes nodes](/docs/admin/cluster-management/#upgrading-a-cluster) to Kubernetes version 1.5 or later. This step is optional, but needs to be done after all StatefulSets diff --git a/docs/tasks/troubleshoot/debug-init-containers.md b/docs/tasks/troubleshoot/debug-init-containers.md index 1739c03f5a..3c362c5072 100644 --- a/docs/tasks/troubleshoot/debug-init-containers.md +++ b/docs/tasks/troubleshoot/debug-init-containers.md @@ -30,7 +30,7 @@ Init Containers. {% capture steps %} -### Checking the status of Init Containers +## Checking the status of Init Containers The Pod status will give you an overview of Init Container execution: @@ -49,7 +49,7 @@ NAME READY STATUS RESTARTS AGE See [Understanding Pod status](#understanding-pod-status) for more examples of status values and their meanings. -### Getting details about Init Containers +## Getting details about Init Containers You can see detailed information about Init Container execution by running: @@ -98,7 +98,7 @@ kubectl get pod --template '{{index .metadata.annotations "pod.beta.k This will return the same information as above, but in raw JSON format. -### Accessing logs from Init Containers +## Accessing logs from Init Containers You can access logs for an Init Container by passing its Container name along with the Pod name: @@ -115,7 +115,7 @@ commands as they're executed. For example, you can do this in Bash by running {% capture discussion %} -### Understanding Pod status +## Understanding Pod status A Pod status beginning with `Init:` summarizes the status of Init Container execution. The table below describes some example status values that you might diff --git a/docs/tutorials/services/source-ip.md b/docs/tutorials/services/source-ip.md index 6efdb42870..56daa8b345 100644 --- a/docs/tutorials/services/source-ip.md +++ b/docs/tutorials/services/source-ip.md @@ -15,7 +15,7 @@ of Services, and how you can toggle this behavior according to your needs. {% include task-tutorial-prereqs.md %} -### Terminology +## Terminology This document makes use of the following terms: @@ -26,7 +26,7 @@ This document makes use of the following terms: * [Kube-proxy](/docs/user-guide/services/#virtual-ips-and-service-proxies): a network daemon that orchestrates Service VIP management on every node -### Prerequisites +## Prerequisites You must have a working Kubernetes 1.5 cluster to run the examples in this document. The examples use a small nginx webserver that echoes back the source @@ -50,7 +50,7 @@ deployment "source-ip-app" created {% capture lessoncontent %} -### Source IP for Services with Type=ClusterIP +## Source IP for Services with Type=ClusterIP Packets sent to ClusterIP from within the cluster are never source NAT'd if you're running kube-proxy in [iptables mode](/docs/user-guide/services/#proxy-mode-iptables), @@ -107,7 +107,7 @@ command=GET ... ``` -### Source IP for Services with Type=NodePort +## Source IP for Services with Type=NodePort As of Kubernetes 1.5, packets sent to Services with [Type=NodePort](/docs/user-guide/services/#type-nodeport) are source NAT'd by default. You can test this by creating a `NodePort` Service: @@ -204,7 +204,7 @@ Visually: -### Source IP for Services with Type=LoadBalancer +## Source IP for Services with Type=LoadBalancer As of Kubernetes 1.5, packets sent to Services with [Type=LoadBalancer](/docs/user-guide/services/#type-loadbalancer) are source NAT'd by default, because all schedulable Kubernetes nodes in the diff --git a/docs/tutorials/stateful-application/basic-stateful-set.md b/docs/tutorials/stateful-application/basic-stateful-set.md index 179dd94f71..25621354af 100644 --- a/docs/tutorials/stateful-application/basic-stateful-set.md +++ b/docs/tutorials/stateful-application/basic-stateful-set.md @@ -51,7 +51,7 @@ After this tutorial, you will be familiar with the following. {% endcapture %} {% capture lessoncontent %} -### Creating a StatefulSet +## Creating a StatefulSet Begin by creating a StatefulSet using the example below. It is similar to the example presented in the @@ -95,7 +95,7 @@ NAME DESIRED CURRENT AGE web 2 1 20s ``` -#### Ordered Pod Creation +### Ordered Pod Creation For a StatefulSet with N replicas, when Pods are being deployed, they are created sequentially, in order from {0..N-1}. Examine the output of the @@ -120,11 +120,11 @@ Notice that the `web-0` Pod is launched and set to Pending prior to launching `web-1`. In fact, `web-1` is not launched until `web-0` is [Running and Ready](/docs/user-guide/pod-states). -### Pods in a StatefulSet +## Pods in a StatefulSet Unlike Pods in other controllers, the Pods in a StatefulSet have a unique ordinal index and a stable network identity. -#### Examining the Pod's Ordinal Index +### Examining the Pod's Ordinal Index Get the StatefulSet's Pods. @@ -143,7 +143,7 @@ Set controller. The Pods' names take the form `-`. Since the `web` StatefulSet has two replicas, it creates two Pods, `web-0` and `web-1`. -#### Using Stable Network Identities +### Using Stable Network Identities Each Pod has a stable hostname based on its ordinal index. Use [`kubectl exec`](/docs/user-guide/kubectl/kubectl_exec/) to execute the `hostname` command in each Pod. @@ -253,7 +253,7 @@ liveness and readiness, you can use the SRV records of the Pods ( application will be able to discover the Pods' addresses when they transition to Running and Ready. -#### Writing to Stable Storage +### Writing to Stable Storage Get the PersistentVolumeClaims for `web-0` and `web-1`. @@ -326,14 +326,14 @@ Volume Claims are remounted to their `volumeMount`s. No matter what node `web-0` and `web-1` are scheduled on, their PersistentVolumes will be mounted to the appropriate mount points. -### Scaling a StatefulSet +## Scaling a StatefulSet Scaling a StatefulSet refers to increasing or decreasing the number of replicas. This is accomplished by updating the `replicas` field. You can use either [`kubectl scale`](/docs/user-guide/kubectl/kubectl_scale/) or [`kubectl patch`](/docs/user-guide/kubectl/kubectl_patch/) to scale a Stateful Set. -#### Scaling Up +### Scaling Up In one terminal window, watch the Pods in the StatefulSet. @@ -378,7 +378,7 @@ created each Pod sequentially with respect to its ordinal index, and it waited for each Pod's predecessor to be Running and Ready before launching the subsequent Pod. -#### Scaling Down +### Scaling Down In one terminal, watch the StatefulSet's Pods. @@ -412,7 +412,7 @@ web-3 1/1 Terminating 0 42s web-3 1/1 Terminating 0 42s ``` -#### Ordered Pod Termination +### Ordered Pod Termination The controller deleted one Pod at a time, with respect to its ordinal index, in reverse order, and it waited for each to be completely shutdown before @@ -438,7 +438,7 @@ the StatefulSet's Pods are deleted. This is still true when Pod deletion is caused by scaling the StatefulSet down. This feature can be used to facilitate upgrading the container images of Pods in a StatefulSet. -### Updating Containers +## Updating Containers As demonstrated in the [Scaling a StatefulSet](#scaling-a-statefulset) section, the `replicas` field of a StatefulSet is mutable. The only other field of a StatefulSet that can be updated is the `spec.template.containers` field. @@ -530,14 +530,14 @@ gcr.io/google_containers/nginx-slim:0.7 All the Pods in the StatefulSet are now running a new container image. -### Deleting StatefulSets +## Deleting StatefulSets StatefulSet supports both Non-Cascading and Cascading deletion. In a Non-Cascading Delete, the StatefulSet's Pods are not deleted when the Stateful Set is deleted. In a Cascading Delete, both the StatefulSet and its Pods are deleted. -#### Non-Cascading Delete +### Non-Cascading Delete In one terminal window, watch the Pods in the StatefulSet. @@ -643,7 +643,7 @@ because the StatefulSet never deletes the PersistentVolumes associated with a Pod. When you recreated the StatefulSet and it relaunched `web-0`, its original PersistentVolume was remounted. -#### Cascading Delete +### Cascading Delete In one terminal window, watch the Pods in the StatefulSet. diff --git a/docs/tutorials/stateful-application/run-replicated-stateful-application.md b/docs/tutorials/stateful-application/run-replicated-stateful-application.md index 30d22e1cce..cdc373b00d 100644 --- a/docs/tutorials/stateful-application/run-replicated-stateful-application.md +++ b/docs/tutorials/stateful-application/run-replicated-stateful-application.md @@ -49,12 +49,12 @@ on general patterns for running stateful applications in Kubernetes. {% capture lessoncontent %} -### Deploying MySQL +## Deploying MySQL The example MySQL deployment consists of a ConfigMap, two Services, and a StatefulSet. -#### ConfigMap +### ConfigMap Create the ConfigMap from the following YAML configuration file: @@ -74,7 +74,7 @@ portions to apply to different Pods. Each Pod decides which portion to look at as it's initializing, based on information provided by the StatefulSet controller. -#### Services +### Services Create the Services from the following YAML configuration file: @@ -100,7 +100,7 @@ Because there is only one MySQL master, clients should connect directly to the MySQL master Pod (through its DNS entry within the Headless Service) to execute writes. -#### StatefulSet +### StatefulSet Finally, create the StatefulSet from the following YAML configuration file: @@ -133,7 +133,7 @@ This manifest uses a variety of techniques for managing stateful Pods as part of a StatefulSet. The next section highlights some of these techniques to explain what happens as the StatefulSet creates Pods. -### Understanding stateful Pod initialization +## Understanding stateful Pod initialization The StatefulSet controller starts Pods one at a time, in order by their ordinal index. @@ -146,7 +146,7 @@ In this case, that results in Pods named `mysql-0`, `mysql-1`, and `mysql-2`. The Pod template in the above StatefulSet manifest takes advantage of these properties to perform orderly startup of MySQL replication. -#### Generating configuration +### Generating configuration Before starting any of the containers in the Pod spec, the Pod first runs any [Init Containers](/docs/user-guide/production-pods/#handling-initialization) @@ -175,7 +175,7 @@ Combined with the StatefulSet controller's this ensures the MySQL master is Ready before creating slaves, so they can begin replicating. -#### Cloning existing data +### Cloning existing data In general, when a new Pod joins the set as a slave, it must assume the MySQL master might already have data on it. It also must assume that the replication @@ -196,7 +196,7 @@ from the Pod whose ordinal index is one lower. This works because the StatefulSet controller always ensures Pod `N` is Ready before starting Pod `N+1`. -#### Starting replication +### Starting replication After the Init Containers complete successfully, the regular containers run. The MySQL Pods consist of a `mysql` container that runs the actual `mysqld` @@ -220,7 +220,7 @@ connections from other Pods requesting a data clone. This server remains up indefinitely in case the StatefulSet scales up, or in case the next Pod loses its PersistentVolumeClaim and needs to redo the clone. -### Sending client traffic +## Sending client traffic You can send test queries to the MySQL master (hostname `mysql-0.mysql`) by running a temporary container with the `mysql:5.7` image and running the @@ -287,13 +287,13 @@ endpoint might be selected upon each connection attempt: You can press **Ctrl+C** when you want to stop the loop, but it's useful to keep it running in another window so you can see the effects of the following steps. -### Simulating Pod and Node downtime +## Simulating Pod and Node downtime To demonstrate the increased availability of reading from the pool of slaves instead of a single server, keep the `SELECT @@server_id` loop from above running while you force a Pod out of the Ready state. -#### Break the Readiness Probe +### Break the Readiness Probe The [readiness probe](/docs/user-guide/production-pods/#liveness-and-readiness-probes-aka-health-checks) for the `mysql` container runs the command `mysql -h 127.0.0.1 -e 'SELECT 1'` @@ -333,7 +333,7 @@ after a few seconds: kubectl exec mysql-2 -c mysql -- mv /usr/bin/mysql.off /usr/bin/mysql ``` -#### Delete Pods +### Delete Pods The StatefulSet also recreates Pods if they're deleted, similar to what a ReplicaSet does for stateless Pods. @@ -348,7 +348,7 @@ PersistentVolumeClaim. You should see server ID `102` disappear from the loop output for a while and then return on its own. -#### Drain a Node +### Drain a Node If your Kubernetes cluster has multiple Nodes, you can simulate Node downtime (such as when Nodes are upgraded) by issuing a @@ -407,7 +407,7 @@ Now uncordon the Node to return it to a normal state: kubectl uncordon ``` -### Scaling the number of slaves +## Scaling the number of slaves With MySQL replication, you can scale your read query capacity by adding slaves. With StatefulSet, you can do this with a single command: diff --git a/docs/tutorials/stateful-application/run-stateful-application.md b/docs/tutorials/stateful-application/run-stateful-application.md index 928aaecacd..dc7655831f 100644 --- a/docs/tutorials/stateful-application/run-stateful-application.md +++ b/docs/tutorials/stateful-application/run-stateful-application.md @@ -37,7 +37,7 @@ application is MySQL. {% capture lessoncontent %} -### Set up a disk in your environment +## Set up a disk in your environment You can use any type of persistent volume for your stateful app. See [Types of Persistent Volumes](/docs/user-guide/persistent-volumes/#types-of-persistent-volumes) @@ -66,7 +66,7 @@ kubectl create -f http://k8s.io/docs/tutorials/stateful-application/gce-volume.y ``` -### Deploy MySQL +## Deploy MySQL You can run a stateful application by creating a Kubernetes Deployment and connecting it to an existing PersistentVolume using a @@ -146,7 +146,7 @@ for a secure solution. Access Modes: RWO No events. -### Accessing the MySQL instance +## Accessing the MySQL instance The preceding YAML file creates a service that allows other Pods in the cluster to access the database. The Service option @@ -171,7 +171,7 @@ If you don't see a command prompt, try pressing enter. mysql> ``` -### Updating +## Updating The image or any other part of the Deployment can be updated as usual with the `kubectl apply` command. Here are some precautions that are @@ -187,7 +187,7 @@ specific to stateful apps: one Pod running at a time. The `Recreate` strategy will stop the first pod before creating a new one with the updated configuration. -### Deleting a deployment +## Deleting a deployment Delete the deployed objects by name: diff --git a/docs/tutorials/stateful-application/zookeeper.md b/docs/tutorials/stateful-application/zookeeper.md index 1b550fe718..836192de9f 100644 --- a/docs/tutorials/stateful-application/zookeeper.md +++ b/docs/tutorials/stateful-application/zookeeper.md @@ -58,7 +58,7 @@ After this tutorial, you will know the following. {% capture lessoncontent %} -#### ZooKeeper Basics +### ZooKeeper Basics [Apache ZooKeeper](https://zookeeper.apache.org/doc/current/) is a distributed, open-source coordination service for distributed applications. @@ -86,7 +86,7 @@ snapshot their in memory state to storage media. These snapshots can be loaded directly into memory, and all WAL entries that preceded the snapshot may be safely discarded. -### Creating a ZooKeeper Ensemble +## Creating a ZooKeeper Ensemble The manifest below contains a [Headless Service](/docs/user-guide/services/#headless-services), @@ -145,7 +145,7 @@ zk-2 1/1 Running 0 40s The StatefulSet controller creates three Pods, and each Pod has a container with a [ZooKeeper 3.4.9](http://www-us.apache.org/dist/zookeeper/zookeeper-3.4.9/) server. -#### Facilitating Leader Election +### Facilitating Leader Election As there is no terminating algorithm for electing a leader in an anonymous network, Zab requires explicit membership configuration in order to perform @@ -242,7 +242,7 @@ server.2=zk-1.zk-headless.default.svc.cluster.local:2888:3888 server.3=zk-2.zk-headless.default.svc.cluster.local:2888:3888 ``` -#### Achieving Consensus +### Achieving Consensus Consensus protocols require that the identifiers of each participant be unique. No two participants in the Zab protocol should claim the same unique @@ -301,7 +301,7 @@ and at least two of the Pods are Running and Ready), or they will fail to do so (if either of the aforementioned conditions are not met). No state will arise where one server acknowledges a write on behalf of another. -#### Sanity Testing the Ensemble +### Sanity Testing the Ensemble The most basic sanity test is to write some data to one ZooKeeper server and to read the data from another. @@ -348,7 +348,7 @@ dataLength = 5 numChildren = 0 ``` -#### Providing Durable Storage +### Providing Durable Storage As mentioned in the [ZooKeeper Basics](#zookeeper-basics) section, ZooKeeper commits all entries to a durable WAL, and periodically writes snapshots @@ -507,7 +507,7 @@ same PersistentVolume mounted to the ZooKeeper server's data directory. Even when the Pods are rescheduled, all of the writes made to the ZooKeeper servers' WALs, and all of their snapshots, remain durable. -### Ensuring Consistent Configuration +## Ensuring Consistent Configuration As noted in the [Facilitating Leader Election](#facilitating-leader-election) and [Achieving Consensus](#achieving-consensus) sections, the servers in a @@ -651,7 +651,7 @@ ZK_DATA_LOG_DIR=/var/lib/zookeeper/log ZK_LOG_DIR=/var/log/zookeeper ``` -#### Configuring Logging +### Configuring Logging One of the files generated by the `zkConfigGen.sh` script controls ZooKeeper's logging. ZooKeeper uses [Log4j](http://logging.apache.org/log4j/2.x/), and, by default, @@ -721,7 +721,7 @@ For cluster level log shipping and aggregation, you should consider deploying a [sidecar](http://blog.kubernetes.io/2015/06/the-distributed-system-toolkit-patterns.html) container to rotate and ship your logs. -#### Configuring a Non-Privileged User +### Configuring a Non-Privileged User The best practices with respect to allowing an application to run as a privileged user inside of a container are a matter of debate. If your organization requires @@ -773,7 +773,7 @@ and the ZooKeeper process is able to successfully read and write its data. drwxr-sr-x 3 zookeeper zookeeper 4096 Dec 5 20:45 /var/lib/zookeeper/data ``` -### Managing the ZooKeeper Process +## Managing the ZooKeeper Process The [ZooKeeper documentation](https://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_supervision) documentation indicates that "You will want to have a supervisory process that @@ -783,7 +783,7 @@ common pattern. When deploying an application in Kubernetes, rather than using an external utility as a supervisory process, you should use Kubernetes as the watchdog for your application. -#### Handling Process Failure +### Handling Process Failure [Restart Policies](/docs/user-guide/pod-states/#restartpolicy) control how @@ -846,7 +846,7 @@ child process. This ensures that Kubernetes will restart the application's container when the process implementing the application's business logic fails. -#### Testing for Liveness +### Testing for Liveness Configuring your application to restart failed processes is not sufficient to @@ -918,7 +918,7 @@ zk-0 1/1 Running 1 1h ``` -#### Testing for Readiness +### Testing for Readiness Readiness is not the same as liveness. If a process is alive, it is scheduled @@ -951,7 +951,7 @@ to specify both. This ensures that only healthy servers in the ZooKeeper ensemble receive network traffic. -### Tolerating Node Failure +## Tolerating Node Failure ZooKeeper needs a quorum of servers in order to successfully commit mutations to data. For a three server ensemble, two servers must be healthy in order for @@ -1013,7 +1013,7 @@ Service in the domain defined by the `topologyKey`. The `topologyKey` different rules, labels, and selectors, you can extend this technique to spread your ensemble across physical, network, and power failure domains. -### Surviving Maintenance +## Surviving Maintenance **In this section you will cordon and drain nodes. If you are using this tutorial on a shared cluster, be sure that this will not adversely affect other tenants.** diff --git a/docs/tutorials/stateless-application/expose-external-ip-address-service.md b/docs/tutorials/stateless-application/expose-external-ip-address-service.md index 23bffda9df..f4a63b1e31 100644 --- a/docs/tutorials/stateless-application/expose-external-ip-address-service.md +++ b/docs/tutorials/stateless-application/expose-external-ip-address-service.md @@ -29,7 +29,7 @@ provides load balancing for an application that has two running instances. {% capture lessoncontent %} -### Creating a service for an application running in two pods +## Creating a service for an application running in two pods 1. Run a Hello World application in your cluster: @@ -111,7 +111,7 @@ provides load balancing for an application that has two running instances. Hello Kubernetes! -### Using a service configuration file +## Using a service configuration file As an alternative to using `kubectl expose`, you can use a [service configuration file](/docs/user-guide/services/operations) diff --git a/docs/tutorials/stateless-application/expose-external-ip-address.md b/docs/tutorials/stateless-application/expose-external-ip-address.md index f21abf7e61..665a06a2b0 100644 --- a/docs/tutorials/stateless-application/expose-external-ip-address.md +++ b/docs/tutorials/stateless-application/expose-external-ip-address.md @@ -36,7 +36,7 @@ external IP address. {% capture lessoncontent %} -### Creating a service for an application running in five pods +## Creating a service for an application running in five pods 1. Run a Hello World application in your cluster: diff --git a/docs/tutorials/stateless-application/hello-minikube.md b/docs/tutorials/stateless-application/hello-minikube.md index 4f75960b4e..9e6a93e5c3 100644 --- a/docs/tutorials/stateless-application/hello-minikube.md +++ b/docs/tutorials/stateless-application/hello-minikube.md @@ -38,7 +38,7 @@ driver. {% capture lessoncontent %} -### Create a Minikube cluster +## Create a Minikube cluster This tutorial uses [Minikube](https://github.com/kubernetes/minikube) to create a local cluster. This tutorial also assumes you are using @@ -94,7 +94,7 @@ Verify that `kubectl` is configured to communicate with your cluster: kubectl cluster-info ``` -### Create your Node.js application +## Create your Node.js application The next step is to write the application. Save this code in a folder named `hellonode` with the filename `server.js`: @@ -113,7 +113,7 @@ Stop the running Node.js server by pressing **Ctrl-C**. The next step is to package your application in a Docker container. -### Create a Docker container image +## Create a Docker container image Create a file, also in the `hellonode` folder, named `Dockerfile`. A Dockerfile describes the image that you want to build. You can build a Docker container image by extending an @@ -145,7 +145,7 @@ docker build -t hello-node:v1 . Now the Minikube VM can run the image you built. -### Create a Deployment +## Create a Deployment A Kubernetes [*Pod*](/docs/user-guide/pods/) is a group of one or more Containers, tied together for the purposes of administration and networking. The Pod in this @@ -206,7 +206,7 @@ kubectl config view For more information about `kubectl`commands, see the [kubectl overview](/docs/user-guide/kubectl-overview/). -### Create a Service +## Create a Service By default, the Pod is only accessible by its internal IP address within the Kubernetes cluster. To make the `hello-node` Container accessible from outside the @@ -254,7 +254,7 @@ you should now be able to see some logs: kubectl logs ``` -### Update your app +## Update your app Edit your `server.js` file to return a new message: @@ -281,7 +281,7 @@ Run your app again to view the new message: minikube service hello-node ``` -### Clean up +## Clean up Now you can clean up the resources you created in your cluster: diff --git a/docs/tutorials/stateless-application/run-stateless-application-deployment.md b/docs/tutorials/stateless-application/run-stateless-application-deployment.md index 06ccc74579..8e3d725752 100644 --- a/docs/tutorials/stateless-application/run-stateless-application-deployment.md +++ b/docs/tutorials/stateless-application/run-stateless-application-deployment.md @@ -27,7 +27,7 @@ This page shows how to run an application using a Kubernetes Deployment object. {% capture lessoncontent %} -### Creating and exploring an nginx deployment +## Creating and exploring an nginx deployment You can run an application by creating a Kubernetes Deployment object, and you can describe a Deployment in a YAML file. For example, this YAML file describes @@ -72,7 +72,7 @@ a Deployment that runs the nginx:1.7.9 Docker image: where `` is the name of one of your pods. -### Updating the deployment +## Updating the deployment You can update the deployment by applying a new YAML file. This YAML file specifies that the deployment should be updated to use nginx 1.8. @@ -87,7 +87,7 @@ specifies that the deployment should be updated to use nginx 1.8. kubectl get pods -l app=nginx -### Scaling the application by increasing the replica count +## Scaling the application by increasing the replica count You can increase the number of pods in your Deployment by applying a new YAML file. This YAML file sets `replicas` to 4, which specifies that the Deployment @@ -111,7 +111,7 @@ should have four pods: nginx-deployment-148880595-fxcez 1/1 Running 0 2m nginx-deployment-148880595-rwovn 1/1 Running 0 2m -### Deleting a deployment +## Deleting a deployment Delete the deployment by name: