From 809c3cf9b546cd8284f3c002c45c244cc783ba83 Mon Sep 17 00:00:00 2001 From: steveperry-53 Date: Thu, 12 Jan 2017 16:29:19 -0800 Subject: [PATCH 1/2] Redirect User Guide topic: Working with Containers in Production. --- _data/guides.yml | 1 - docs/tasks/index.md | 3 + docs/user-guide/production-pods.md | 245 ----------------------------- 3 files changed, 3 insertions(+), 246 deletions(-) delete mode 100644 docs/user-guide/production-pods.md diff --git a/_data/guides.yml b/_data/guides.yml index 9d08a88367..c1bdd99a4e 100644 --- a/_data/guides.yml +++ b/_data/guides.yml @@ -71,7 +71,6 @@ toc: - docs/user-guide/pods/init-container.md - docs/user-guide/configuring-containers.md - docs/user-guide/pod-templates.md - - docs/user-guide/production-pods.md - docs/user-guide/containers.md - docs/user-guide/environment-guide/index.md - docs/user-guide/compute-resources.md diff --git a/docs/tasks/index.md b/docs/tasks/index.md index 2482a13677..92521ad0dd 100644 --- a/docs/tasks/index.md +++ b/docs/tasks/index.md @@ -1,5 +1,8 @@ --- title: Tasks +redirect_from: +- "/docs/user-guide/production-pods/" +- "/docs/user-guide/production-pods.html" --- This section of the Kubernetes documentation contains pages that diff --git a/docs/user-guide/production-pods.md b/docs/user-guide/production-pods.md deleted file mode 100644 index 586838f852..0000000000 --- a/docs/user-guide/production-pods.md +++ /dev/null @@ -1,245 +0,0 @@ ---- -assignees: -- bgrant0607 -- janetkuo -- thockin -title: Working with Containers in Production ---- - -You've seen [how to configure and deploy pods and containers](/docs/user-guide/configuring-containers), using some of the most common configuration parameters. This section dives into additional features that are especially useful for running applications in production. - -* TOC -{:toc} - -## Using a Volume for storage - -The container file system only lives as long as the container does, so when a container crashes and restarts, changes to the filesystem will be lost and the container will restart from a clean slate. For more consistent storage that lasts for the life of a Pod, you need a [*volume*](/docs/user-guide/volumes). This is especially important to stateful applications, such as key-value stores and databases. - -For example, [Redis](http://redis.io/) is a key-value cache and store, which we use in the [guestbook](https://github.com/kubernetes/kubernetes/tree/{{page.githubbranch}}/examples/guestbook/) and other examples. We can add a volume to it to store data as follows: - -{% include code.html language="yaml" file="redis-deployment.yaml" ghlink="/docs/user-guide/redis-deployment.yaml" %} - -`emptyDir` volumes live for the lifespan of the [pod](/docs/user-guide/pods), which is longer than the lifespan of any one container, so if the container fails and is restarted, our storage will live on. - -In addition to the local disk storage provided by `emptyDir`, Kubernetes supports many different network-attached storage solutions, including PD on GCE and EBS on EC2, which are preferred for critical data, and will handle details such as mounting and unmounting the devices on the nodes. See [the volumes doc](/docs/user-guide/volumes) for more details. - -## Distributing credentials - -Many applications need credentials, such as passwords, OAuth tokens, and TLS keys, to authenticate with other applications, databases, and services. Storing these credentials in container images or environment variables is less than ideal, since the credentials can then be copied by anyone with access to the image, pod/container specification, host file system, or host Docker daemon. - -Kubernetes provides a mechanism, called [*secrets*](/docs/user-guide/secrets), that facilitates delivery of sensitive credentials to applications. A `Secret` is a simple resource containing a map of data. For instance, you can create a simple secret with a username and password as follows: - -```shell -$ kubectl create secret generic mysecret --from-literal=username="admin",password="1234" -secret "mysecret" created -``` - -This is equivalent to `kubectl create -f`: - -```yaml -apiVersion: v1 -kind: Secret -metadata: - name: mysecret -type: Opaque -data: - username: YWRtaW4= - password: MTIzNA== -``` - -As with other resources, the created secret can be viewed with `get`: - -```shell -$ kubectl get secrets -NAME TYPE DATA AGE -default-token-zirbw kubernetes.io/service-account-token 3 3h -mysecret Opaque 2 2m -``` - -To use the secret, you need to reference it in a pod or pod template. The `secret` volume source enables you to mount it as an in-memory directory into your containers. - -{% include code.html language="yaml" file="redis-secret-deployment.yaml" ghlink="/docs/user-guide/redis-secret-deployment.yaml" %} - -For more details, see the [secrets document](/docs/user-guide/secrets), [example](/docs/user-guide/secrets/) and [design doc](https://github.com/kubernetes/kubernetes/blob/{{page.githubbranch}}/docs/design/secrets.md). - -## Authenticating with a private image registry - -Secrets can also be used to pass [image registry credentials](/docs/user-guide/images/#using-a-private-registry). - -The easiest way to create a secret for Docker registry is: - -```shell -$ kubectl create secret docker-registry myregistrykey --docker-username=janedoe --docker-password=●●●●●●●●●●● --docker-email=jdoe@example.com -secret "myregistrykey" created -``` - -Alternatively, you can do the equivalent with the following steps. First, create a `.docker/config.json`, such as by running `docker login `. -Then put the resulting `.docker/config.json` file into a [secret resource](secrets.md). For example: - -```shell -$ docker login -Username: janedoe -Password: ●●●●●●●●●●● -Email: jdoe@example.com -WARNING: login credentials saved in /Users/jdoe/.docker/config.json. -Login Succeeded - -$ echo $(cat ~/.docker/config.json) -{ "https://index.docker.io/v1/": { "auth": "ZmFrZXBhc3N3b3JkMTIK", "email": "jdoe@example.com" } } - -$ cat ~/.docker/config.json | base64 -eyAiaHR0cHM6Ly9pbmRleC5kb2NrZXIuaW8vdjEvIjogeyAiYXV0aCI6ICJabUZyWlhCaGMzTjNiM0prTVRJSyIsICJlbWFpbCI6ICJqZG9lQGV4YW1wbGUuY29tIiB9IH0K - -$ cat > /tmp/image-pull-secret.yaml < Date: Tue, 17 Jan 2017 15:16:27 -0800 Subject: [PATCH 2/2] 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: