Merge branch 'master' into release-1.7

This commit is contained in:
steveperry-53
2017-08-22 13:02:54 -07:00
26 changed files with 96 additions and 331 deletions
+4
View File
@@ -1,3 +1,7 @@
---
title: kubefed
notitle: true
---
## kubefed
kubefed controls a Kubernetes Cluster Federation
+4
View File
@@ -1,3 +1,7 @@
---
title: kubefed init
notitle: true
---
## kubefed init
Initialize a federation control plane
+4
View File
@@ -1,3 +1,7 @@
---
title: kubefed join
notitle: true
---
## kubefed join
Join a cluster to a federation
+4
View File
@@ -1,3 +1,7 @@
---
title: kubefed options
notitle: true
---
## kubefed options
Print the list of flags inherited by all commands
+4
View File
@@ -1,3 +1,7 @@
---
title: kubefed unjoin
notitle: true
---
## kubefed unjoin
Unjoin a cluster from a federation
+4
View File
@@ -1,3 +1,7 @@
---
title: kubefed version
notitle: true
---
## kubefed version
Print the client and server version information
@@ -33,7 +33,7 @@ $ kubectl create -f https://k8s.io/docs/tasks/debug-application-cluster/counter-
pod "counter" created
```
To fetch the logs, use the `kubectl logs` command, as follows
To fetch the logs, use the `kubectl logs` command, as follows:
```shell
$ kubectl logs counter
@@ -37,7 +37,7 @@ review the "normal" way that networking works with Docker. By default, Docker
uses host-private networking. It creates a virtual bridge, called `docker0` by
default, and allocates a subnet from one of the private address blocks defined
in [RFC1918](https://tools.ietf.org/html/rfc1918) for that bridge. For each
container that Docker creates, it allocates a virtual ethernet device (called
container that Docker creates, it allocates a virtual Ethernet device (called
`veth`) which is attached to the bridge. The veth is mapped to appear as `eth0`
in the container, using Linux namespaces. The in-container `eth0` interface is
given an IP address from the bridge's address range.
+2 -2
View File
@@ -42,7 +42,7 @@ _Pod Security Policies_ are comprised of settings and strategies that
control the security features a pod has access to. These settings fall
into three categories:
- *Controlled by a boolean*: Fields of this type default to the most
- *Controlled by a Boolean*: Fields of this type default to the most
restrictive value.
- *Controlled by an allowable set*: Fields of this type are checked
against the set to ensure their values are allowed.
@@ -193,7 +193,7 @@ podsecuritypolicy "permissive" deleted
In order to use Pod Security Policies in your cluster you must ensure the
following
1. You have enabled the api type `extensions/v1beta1/podsecuritypolicy` (only for versions prior 1.6)
1. You have enabled the API type `extensions/v1beta1/podsecuritypolicy` (only for versions prior 1.6)
1. You have enabled the admission controller `PodSecurityPolicy`
1. You have defined your policies
+1 -1
View File
@@ -30,7 +30,7 @@ Resource quotas work like this:
Examples of policies that could be created using namespaces and quotas are:
- In a cluster with a capacity of 32 GiB RAM, and 16 cores, let team A use 20 Gib and 10 cores,
- In a cluster with a capacity of 32 GiB RAM, and 16 cores, let team A use 20 GiB and 10 cores,
let B use 10GiB and 4 cores, and hold 2GiB and 2 cores in reserve for future allocation.
- Limit the "testing" namespace to using 1 core and 1GiB RAM. Let the "production" namespace
use any amount.
+14 -5
View File
@@ -581,18 +581,27 @@ __Important: You must create VMDK using one of the following method before using
#### Creating a VMDK volume
* Create using vmkfstools.
Choose one of the following methods to create a VMDK.
First ssh into ESX and then use following command to create vmdk,
{% capture vmkfstools %}
First ssh into ESX, then use the following command to create a VMDK:
```shell
vmkfstools -c 2G /vmfs/volumes/DatastoreName/volumes/myDisk.vmdk
vmkfstools -c 2G /vmfs/volumes/DatastoreName/volumes/myDisk.vmdk
```
{% endcapture %}
{% capture vdiskmanager %}
Use the following command to create a VMDK:
* Create using vmware-vdiskmanager.
```shell
vmware-vdiskmanager -c -t 0 -s 40GB -a lsilogic myDisk.vmdk
vmware-vdiskmanager -c -t 0 -s 40GB -a lsilogic myDisk.vmdk
```
{% endcapture %}
{% assign tab_names = 'Create using vmkfstools,Create using vmware-vdiskmanager' | split: ',' | compact %}
{% assign tab_contents = site.emptyArray | push: vmkfstools | push: vdiskmanager %}
{% include tabs.md %}
#### vSphere VMDK Example configuration
+3 -3
View File
@@ -33,7 +33,7 @@ variables:</p>
<li>whatsnext - optional</li>
</ul>
Then include templates/task.md like this:
<p>Then include templates/task.md like this:</p>
{% raw %}<pre>...
{% include templates/task.md %}</pre>{% endraw %}
@@ -105,7 +105,7 @@ variables:</p>
<li>whatsnext - optional</li>
</ul>
Then include templates/tutorial.md like this:
<p>Then include templates/tutorial.md like this:</p>
{% raw %}<pre>...
{% include templates/tutorial.md %}</pre>{% endraw %}
@@ -185,7 +185,7 @@ variables:</p>
<li>whatsnext - optional</li>
</ul>
Then include templates/concept.md like this:
<p>Then include templates/concept.md like this:</p>
{% raw %}<pre>...
{% include templates/concept.md %}</pre>{% endraw %}
@@ -138,7 +138,7 @@ current-context: federal-context
`current-context` is the nickname or 'key' for the cluster,user,namespace tuple that kubectl
will use by default when loading config from this file. You can override any of the values in kubectl
from the commandline, by passing `--context=CONTEXT`, `--cluster=CLUSTER`, `--user=USER`, and/or `--namespace=NAMESPACE` respectively.
from the command line, by passing `--context=CONTEXT`, `--cluster=CLUSTER`, `--user=USER`, and/or `--namespace=NAMESPACE` respectively.
You can change the `current-context` with [`kubectl config use-context`](/docs/user-guide/kubectl/{{page.version}}/#-em-use-context-em-).
#### miscellaneous
@@ -315,7 +315,7 @@ So, tying this all together, a quick start to create your own kubeconfig file:
- Make sure your api-server provides at least one set of credentials (for example, `green-user`) when launched. You will of course have to look at api-server documentation in order to determine the current state-of-the-art in terms of providing authentication details.
## Related discussion
[http://issue.k8s.io/1755](http://issue.k8s.io/1755)
[https://github.com/kubernetes/kubernetes/issues/1755](https://github.com/kubernetes/kubernetes/issues/1755)
{% endcapture %}
{% include templates/task.md %}
@@ -46,7 +46,7 @@ for all items returned.
As an alternative, it is possible to use the absolute path to the image
field within the Pod. This ensures the correct field is retrieved
in the even the field name is repeated,
even when the field name is repeated,
e.g. many fields are called `name` within a given item:
```sh
@@ -137,7 +137,7 @@ program to retrieve the contents of your secret.
4. Verify the secret is correctly decrypted when retrieved via the API:
```
kubectl describe secret generic -n default
kubectl describe secret secret1 -n default
```
should match `mykey: mydata`
@@ -72,7 +72,7 @@ the container starts.
only the termination message:
```
{% raw %} kubectl get pod termination-demo -o go-template="{{range .status.containerStatuses}}{{.lastState.terminated.message}}{{end}}"{% endraw %}
{% raw %} kubectl get pod termination-demo -o go-template="{{range .status.containerStatuses}}{{.lastState.terminated.message}}{{end}}"{% endraw %}
```
## Setting the termination log file
@@ -99,7 +99,7 @@ kubectl rollout status ds/<daemonset-name>
When the rollback is complete, the output is similar to this:
```shell
daemon set "<daemonset-name>" successfully rolled out
daemonset "<daemonset-name>" successfully rolled out
```
{% endcapture %}
@@ -1,48 +1,13 @@
---
title: "Example: Deploying Cassandra with Stateful Sets"
assignees:
- ahmetb
---
<!--
DO NOT UPDATE THIS FILE!
Submit a patch to https://github.com/kubernetes/examples and
once it is merged, run ./update-imported-tutorials.sh to
import it to the website.
-->
{% capture overview %}
This tutorial shows you how to develop a native cloud [Cassandra](http://cassandra.apache.org/) deployment on Kubernetes. In this instance, a custom Cassandra `SeedProvider` enables Cassandra to discover new Cassandra nodes as they join the cluster.
Deploying stateful distributed applications, like Cassandra, within a clustered environment can be challenging. StatefulSets greatly simplify this process. Please read about [StatefulSets](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/) for more information about the features used in this tutorial.
Deploying stateful distributed applications, like Cassandra, within a clustered environment can be challenging. StatefulSets greatly simplify this process. Please read about [StatefulSets](/docs/concepts/workloads/controllers/statefulset/) for more information about the features used in this tutorial.
**Cassandra Docker**
@@ -67,20 +32,20 @@ The docker is based on `debian:jessie` and includes OpenJDK 8. This image includ
{% endcapture %}
{% capture prerequisites %}
To complete this tutorial, you should already have a basic familiarity with [Pods](https://kubernetes.io/docs/concepts/workloads/pods/pod/), [Services](https://kubernetes.io/docs/concepts/services-networking/service/), and [StatefulSets](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/). In addition, you should:
To complete this tutorial, you should already have a basic familiarity with [Pods](/docs/concepts/workloads/pods/pod/), [Services](/docs/concepts/services-networking/service/), and [StatefulSets](/docs/concepts/workloads/controllers/statefulset/). In addition, you should:
* [Install and Configure](https://kubernetes.io/docs/tasks/tools/install-kubectl/) the `kubectl` command line
* [Install and Configure](/docs/tasks/tools/install-kubectl/) the `kubectl` command line
* Download [cassandra-service.yaml](https://kubernetes.io/docs/tutorials/stateful-application/cassandra-service.yaml) and [cassandra-statefulset.yaml](https://kubernetes.io/docs/tutorials/stateful-application/cassandra-statefulset.yaml)
* Download [cassandra-service.yaml](/docs/tutorials/stateful-application/cassandra/cassandra-service.yaml) and [cassandra-statefulset.yaml](/docs/tutorials/stateful-application/cassandra/cassandra-statefulset.yaml)
* Have a supported Kubernetes Cluster running
**Note:** Please read the [getting started guides](https://kubernetes.io/docs/setup/pick-right-solution/) if you do not already have a cluster.
**Note:** Please read the [getting started guides](/docs/setup/pick-right-solution/) if you do not already have a cluster.
{: .note}
### Additional Minikube Setup Instructions
**Caution:** [Minikube](https://kubernetes.io/docs/getting-started-guides/minikube/) defaults to 1024MB of memory and 1 CPU which results in an insufficient resource errors during this tutorial.
**Caution:** [Minikube](/docs/getting-started-guides/minikube/) defaults to 1024MB of memory and 1 CPU which results in an insufficient resource errors during this tutorial.
{: .caution}
To avoid these errors, run minikube with:
@@ -91,7 +56,7 @@ To avoid these errors, run minikube with:
{% capture lessoncontent %}
## Creating a Cassandra Headless Service
A Kubernetes [Service](https://kubernetes.io/docs/concepts/services-networking/service/) describes a set of [Pods](https://kubernetes.io/docs/concepts/workloads/pods/pod/) that perform the same task.
A Kubernetes [Service](/docs/concepts/services-networking/service/) describes a set of [Pods](/docs/concepts/workloads/pods/pod/) that perform the same task.
The following `Service` is used for DNS lookups between Cassandra Pods and clients within the Kubernetes Cluster.
@@ -100,7 +65,7 @@ The following `Service` is used for DNS lookups between Cassandra Pods and clien
kubectl create -f cassandra-service.yaml
{% include code.html language="yaml" file="cassandra-service.yaml" ghlink="/docs/tutorials/stateful-application/cassandra-service.yaml" %}
{% include code.html language="yaml" file="cassandra/cassandra-service.yaml" ghlink="/docs/tutorials/stateful-application/cassandra/cassandra-service.yaml" %}
### Validating (optional)
@@ -113,7 +78,7 @@ The response should be
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
cassandra None <none> 9042/TCP 45s
If anything else returns, the service was not successfully created. Read [Debug Services](https://kubernetes.io/docs/tasks/debug-application-cluster/debug-service/) for common issues.
If anything else returns, the service was not successfully created. Read [Debug Services](/docs/tasks/debug-application-cluster/debug-service/) for common issues.
## Using a StatefulSet to Create a Cassandra Ring
@@ -127,7 +92,7 @@ The StatefulSet manifest, included below, creates a Cassandra ring that consists
kubectl create -f cassandra-statefulset.yaml
{% include code.html language="yaml" file="cassandra-statefulset.yaml" ghlink="/docs/tutorials/stateful-application/cassandra-statefulset.yaml" %}
{% include code.html language="yaml" file="cassandra/cassandra-statefulset.yaml" ghlink="/docs/tutorials/stateful-application/cassandra/cassandra-statefulset.yaml" %}
## Validating The Cassandra StatefulSet
@@ -246,14 +211,10 @@ Deleting or scaling a StatefulSet down does not delete the volumes associated wi
{% endcapture %}
{% capture whatsnext %}
* Learn how to [Scale a StatefulSet](https://kubernetes.io/docs/tasks/run-application/scale-stateful-set/).
* Learn how to [Scale a StatefulSet](/docs/tasks/run-application/scale-stateful-set/).
* Learn more about the [KubernetesSeedProvider](https://github.com/kubernetes/examples/blob/master/cassandra/java/src/main/java/io/k8s/cassandra/KubernetesSeedProvider.java)
* See more custom [Seed Provider Configurations](https://git.k8s.io/examples/cassandra/java/README.md)
{% endcapture %}
{% include templates/tutorial.md %}
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/cassandra/README.md?pixel)]()
<!-- END MUNGE: GENERATED_ANALYTICS -->
@@ -1,48 +1,13 @@
---
title: "Example: Deploying WordPress and MySQL with Persistent Volumes"
assignees:
- ahmetb
---
<!--
DO NOT UPDATE THIS FILE!
Submit a patch to https://github.com/kubernetes/examples and
once it is merged, run ./update-imported-tutorials.sh to
import it to the website.
-->
{% capture overview %}
This tutorial shows you how to deploy a WordPress site and a MySQL database using Minikube. Both applications use PersistentVolumes and PersistentVolumeClaims to store data.
A [PersistentVolume](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) (PV) is a piece of storage in the cluster that has been provisioned by an administrator, and a [PeristentVolumeClaim](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims) (PVC) is a set amout of storage in a PV. PersistentVolumes and PeristentVolumeClaims are independent from Pod lifecycles and preserve data through restarting, rescheduling, and even deleting Pods.
A [PersistentVolume](/docs/concepts/storage/persistent-volumes/) (PV) is a piece of storage in the cluster that has been provisioned by an administrator, and a [PeristentVolumeClaim](/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims) (PVC) is a set amout of storage in a PV. PersistentVolumes and PeristentVolumeClaims are independent from Pod lifecycles and preserve data through restarting, rescheduling, and even deleting Pods.
**Warning:** This deployment is not suitable for production use cases, as it uses single instance WordPress and MySQL Pods. Consider using [WordPress Helm Chart](https://github.com/kubernetes/charts/tree/master/stable/wordpress) to deploy WordPress in production.
{: .warning}
@@ -64,11 +29,11 @@ A [PersistentVolume](https://kubernetes.io/docs/concepts/storage/persistent-volu
Download the following configuration files:
1. [local-volumes.yaml](https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/local-volumes.yaml)
1. [local-volumes.yaml](/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/local-volumes.yaml)
1. [mysql-deployment.yaml](https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/mysql-deployment.yaml)
1. [mysql-deployment.yaml](/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/mysql-deployment.yaml)
1. [wordpress-deployment.yaml](https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume//wordpress-deployment.yaml)
1. [wordpress-deployment.yaml](/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/wordpress-deployment.yaml)
{% endcapture %}
@@ -76,7 +41,7 @@ Download the following configuration files:
## Create a PersistentVolume
MySQL and Wordpress each use a PersistentVolume to store data. While Kubernetes supports many different [types of PersistentVolumes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#types-of-persistent-volumes), this tutorial covers [hostPath](https://kubernetes.io/docs/concepts/storage/volumes/#hostpath).
MySQL and Wordpress each use a PersistentVolume to store data. While Kubernetes supports many different [types of PersistentVolumes](/docs/concepts/storage/persistent-volumes/#types-of-persistent-volumes), this tutorial covers [hostPath](/docs/concepts/storage/volumes/#hostpath).
**Note:** If you have a Kubernetes cluster running on Google Container Engine, please follow [this guide](https://cloud.google.com/container-engine/docs/tutorials/persistent-disk).
{: .note}
@@ -109,7 +74,7 @@ A `hostPath` mounts a file or directory from the host nodes filesystem into y
## Create a Secret for MySQL Password
A [Secret](https://kubernetes.io/docs/concepts/configuration/secret/) is an object that stores a piece of sensitive data like a password or key. The manifest files are already configured to use a Secret, but you have to create your own Secret.
A [Secret](/docs/concepts/configuration/secret/) is an object that stores a piece of sensitive data like a password or key. The manifest files are already configured to use a Secret, but you have to create your own Secret.
1. Create the Secret object from the following command:
@@ -216,15 +181,11 @@ The following manifest describes a single-instance WordPress Deployment and Serv
{% capture whatsnext %}
* Learn more about [Introspection and Debugging](https://kubernetes.io/docs/tasks/debug-application-cluster/debug-application-introspection/)
* Learn more about [Jobs](https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/)
* Learn more about [Port Forwarding](https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/)
* Learn how to [Get a Shell to a Container](https://kubernetes.io/docs/tasks/debug-application-cluster/get-shell-running-container/)
* Learn more about [Introspection and Debugging](/docs/tasks/debug-application-cluster/debug-application-introspection/)
* Learn more about [Jobs](/docs/concepts/workloads/controllers/jobs-run-to-completion/)
* Learn more about [Port Forwarding](/docs/tasks/access-application-cluster/port-forward-access-application-cluster/)
* Learn how to [Get a Shell to a Container](/docs/tasks/debug-application-cluster/get-shell-running-container/)
{% endcapture %}
{% include templates/tutorial.md %}
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/examples/mysql-wordpress-pd/README.md?pixel)]()
<!-- END MUNGE: GENERATED_ANALYTICS -->
@@ -1,44 +1,9 @@
---
title: "Example: Deploying PHP Guestbook application with Redis"
assignees:
- ahmetb
---
<!--
DO NOT UPDATE THIS FILE!
Submit a patch to https://github.com/kubernetes/examples and
once it is merged, run ./update-imported-tutorials.sh to
import it to the website.
-->
{% capture overview %}
This tutorial shows you how to build and deploy a simple, multi-tier web application using Kubernetes and [Docker](https://www.docker.com/). This example consists of the following components:
@@ -61,12 +26,12 @@ This tutorial shows you how to build and deploy a simple, multi-tier web applica
{% include task-tutorial-prereqs.md %}
Download the following configuration files:
1. [redis-master-deployment.yaml](https://kubernetes.io/docs/tutorials/stateless-application/guestbook/redis-master-deployment.yaml)
1. [redis-master-service.yaml](https://kubernetes.io/docs/tutorials/stateless-application/guestbook/redis-master-service.yaml)
1. [redis-slave-deployment.yaml](https://kubernetes.io/docs/tutorials/stateless-application/guestbook/redis-slave-deployment.yaml)
1. [redis-slave-service.yaml](https://kubernetes.io/docs/tutorials/stateless-application/guestbook/redis-slave-service.yaml)
1. [frontend-deployment.yaml](https://kubernetes.io/docs/tutorials/stateless-application/guestbook/frontend-deployment.yaml)
1. [frontend-service.yaml](https://kubernetes.io/docs/tutorials/stateless-application/guestbook/frontend-service.yaml)
1. [redis-master-deployment.yaml](/docs/tutorials/stateless-application/guestbook/redis-master-deployment.yaml)
1. [redis-master-service.yaml](/docs/tutorials/stateless-application/guestbook/redis-master-service.yaml)
1. [redis-slave-deployment.yaml](/docs/tutorials/stateless-application/guestbook/redis-slave-deployment.yaml)
1. [redis-slave-service.yaml](/docs/tutorials/stateless-application/guestbook/redis-slave-service.yaml)
1. [frontend-deployment.yaml](/docs/tutorials/stateless-application/guestbook/frontend-deployment.yaml)
1. [frontend-service.yaml](/docs/tutorials/stateless-application/guestbook/frontend-service.yaml)
{% endcapture %}
@@ -105,7 +70,7 @@ The manifest file, included below, specifies a Deployment controller that runs a
### Creating the Redis Master Service
The guestbook applications needs to communicate to the Redis master to write its data. You need to apply a [Service](https://kubernetes.io/docs/concepts/services-networking/service/) to proxy the traffic to the Redis master Pod. A Service defines a policy to access the Pods.
The guestbook applications needs to communicate to the Redis master to write its data. You need to apply a [Service](/docs/concepts/services-networking/service/) to proxy the traffic to the Redis master Pod. A Service defines a policy to access the Pods.
1. Apply the Redis Master Service from the following `redis-master-service.yaml` file:
@@ -199,7 +164,7 @@ The guestbook application has a web frontend serving the HTTP requests written i
### Creating the Frontend Service
The `redis-slave` and `redis-master` Services you applied are only accessible within the container cluster because the default type for a Service is [ClusterIP](https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services---service-types). `ClusterIP` provides a single IP address for the set of Pods the Service is pointing to. This IP address is accessible only within the cluster.
The `redis-slave` and `redis-master` Services you applied are only accessible within the container cluster because the default type for a Service is [ClusterIP](/docs/concepts/services-networking/service/#publishing-services---service-types). `ClusterIP` provides a single IP address for the set of Pods the Service is pointing to. This IP address is accessible only within the cluster.
If you want guests to be able to access your guestbook, you must configure the frontend Service to be externally visible, so a client can request the Service from outside the container cluster. Minikube can only expose Services through `NodePort`.
@@ -326,13 +291,10 @@ Deleting the Deployments and Services also deletes any running Pods. Use labels
{% endcapture %}
{% capture whatsnext %}
* Complete the [Kubernetes Basics](https://kubernetes.io//docs/tutorials/kubernetes-basics/) Interactive Tutorials
* Use Kubernetes to create a blog using [Persistant Volumes for MySQL and Wordpress](https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/#visit-your-new-wordpress-blog)
* Read more about [connecting applications](https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/)
* Read more about [Managing Resources](https://kubernetes.io/docs/concepts/cluster-administration/manage-deployment/#using-labels-effectively)
* Complete the [Kubernetes Basics](/docs/tutorials/kubernetes-basics/) Interactive Tutorials
* Use Kubernetes to create a blog using [Persistant Volumes for MySQL and Wordpress](/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/#visit-your-new-wordpress-blog)
* Read more about [connecting applications](/docs/concepts/services-networking/connect-applications-service/)
* Read more about [Managing Resources](/docs/concepts/cluster-administration/manage-deployment/#using-labels-effectively)
{% endcapture %}
{% include templates/tutorial.md %}
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/examples/guestbook/README.md?pixel)]()
<!-- END MUNGE: GENERATED_ANALYTICS -->
{% include templates/tutorial.md %}
+2
View File
@@ -16,7 +16,9 @@ kubectl [command] [TYPE] [NAME] [flags]
```
where `command`, `TYPE`, `NAME`, and `flags` are:
* `command`: Specifies the operation that you want to perform on one or more resources, for example `create`, `get`, `describe`, `delete`.
* `TYPE`: Specifies the [resource type](#resource-types). Resource types are case-sensitive and you can specify the singular, plural, or abbreviated forms. For example, the following commands produce the same output:
$ kubectl get pod pod1
-6
View File
@@ -4,12 +4,6 @@ docs/getting-started-guides/docker.md
docs/getting-started-guides/docker-multinode.md
docs/user-guide/configmap/README.md
docs/user-guide/downward-api/README.md
docs/admin/kubefed_unjoin.md
docs/admin/kubefed_init.md
docs/admin/kubefed.md
docs/admin/kubefed_join.md
docs/admin/kubefed_options.md
docs/admin/kubefed_version.md
docs/api-reference/extensions/v1beta1/definitions.md
docs/api-reference/extensions/v1beta1/operations.md
docs/api-reference/v1/definitions.md
+2 -1
View File
@@ -136,7 +136,7 @@ done <_data/overrides.yml
)
BINARIES="federation-apiserver.md federation-controller-manager.md kube-apiserver.md kube-controller-manager.md kube-proxy.md kube-scheduler.md kubelet.md"
BINARIES="federation-apiserver.md federation-controller-manager.md kube-apiserver.md kube-controller-manager.md kube-proxy.md kube-scheduler.md kubelet.md kubefed.md kubefed_init.md kubefed_join.md kubefed_options.md kubefed_unjoin.md kubefed_version.md"
(
cd docs/admin
@@ -149,6 +149,7 @@ BINARIES="federation-apiserver.md federation-controller-manager.md kube-apiserve
---' "$bin"
done
)
mv -- "${APIREFDESDIR}" "${APIREFSRCDIR}"
mv -- "${KUBECTLDESDIR}" "${KUBECTLSRCDIR}"
rm -rf -- "${TMPDIR}" "${K8SREPO}"
-149
View File
@@ -1,149 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""This program imports the tutorials from
https://github.com/kubernetes/examples and makes necessary modifications to
check them in as Jekyll-compatible documentation pages.
"""
import os.path
import shutil
import urllib.request
SRC_REPO = 'kubernetes/examples'
SRC_TREE = 'master'
# mapping of tutorials in kubernetes/examples to their
# equivalent files here: (examples-path, docs-path, new-title, imports-map)
TUTORIALS = [
('guestbook/README.md',
'./docs/tutorials/stateless-application/guestbook.md',
"Example: Deploying PHP Guestbook application with Redis", {
"guestbook/redis-master-deployment.yaml" : "./docs/tutorials/stateless-application/guestbook/redis-master-deployment.yaml",
"guestbook/redis-master-service.yaml" : "./docs/tutorials/stateless-application/guestbook/redis-master-service.yaml",
"guestbook/redis-slave-deployment.yaml" : "./docs/tutorials/stateless-application/guestbook/redis-slave-deployment.yaml",
"guestbook/redis-slave-service.yaml" : "./docs/tutorials/stateless-application/guestbook/redis-slave-service.yaml",
"guestbook/frontend-deployment.yaml" : "./docs/tutorials/stateless-application/guestbook/frontend-deployment.yaml",
"guestbook/frontend-service.yaml" : "./docs/tutorials/stateless-application/guestbook/frontend-service.yaml",
}),
('mysql-wordpress-pd/README.md',
'./docs/tutorials/stateful-application/mysql-wordpress-persistent-volume.md',
"Example: Deploying WordPress and MySQL with Persistent Volumes",
{
"mysql-wordpress-pd/local-volumes.yaml": "./docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/local-volumes.yaml",
"mysql-wordpress-pd/mysql-deployment.yaml": "./docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/mysql-deployment.yaml",
"mysql-wordpress-pd/wordpress-deployment.yaml": "./docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/wordpress-deployment.yaml",
}),
('cassandra/README.md',
'./docs/tutorials/stateful-application/cassandra.md',
"Example: Deploying Cassandra with Stateful Sets",
{
"cassandra/cassandra-service.yaml": "./docs/tutorials/stateful-application/cassandra-service.yaml",
"cassandra/cassandra-statefulset.yaml": "./docs/tutorials/stateful-application/cassandra-statefulset.yaml",
}),
]
def main():
for (src_path, dst_path, new_title, imports) in TUTORIALS:
print('Processing {0}'.format(src_path))
imports[src_path] = dst_path # add source itself as import file
for src_path, dst_path in imports.items():
src_url = 'https://github.com/{0}/raw/{1}/{2}'.format(SRC_REPO,
SRC_TREE, src_path)
dst_dir = os.path.dirname(dst_path)
if not os.path.exists(dst_dir):
print('Creating directory {0}.'.format(dst_dir))
os.makedirs(dst_dir)
print('Downloading {0}'.format(src_url))
with urllib.request.urlopen(src_url) as resp, \
open(dst_path, 'wb') as out_file:
shutil.copyfileobj(resp, out_file)
print('Saved to {0}'.format(dst_path))
print('Processing {0}'.format(dst_path))
remove_excluded_snippets(dst_path)
insert_do_not_update(dst_path)
insert_title(dst_path, new_title)
print('Processed {0}'.format(dst_path))
def remove_excluded_snippets(path):
"""Remove content between '<!-- EXCLUDE_FROM_DOCS BEGIN -->' and
'<!-- EXCLUDE_FROM_DOCS END -->' markers (including the markers)
in the specified file. Markers must appear on their own lines."""
marker_begin = '<!-- EXCLUDE_FROM_DOCS BEGIN -->\n'
marker_end = '<!-- EXCLUDE_FROM_DOCS END -->\n'
new_lines = []
started = False
excluded_blocks = 0
with open(path, 'r') as f:
for line_no, line in enumerate(f):
ref = '{0}:{1}'.format(path, line_no)
if (marker_begin.rstrip('\n') in line and
(line != marker_begin and line != marker_end.rstrip('\n'))) or \
(marker_end.rstrip('\n') in line and (line != marker_end and
line != marker_end.rstrip('\n'))):
raise Exception('{0}: EXCLUDE_FROM_DOCS marker must be on its own line'.format(ref))
if not started:
if line == marker_end:
raise Exception('{0}: encountered END before BEGIN'.format(ref))
elif line == marker_begin:
started = True
else:
new_lines.append(line.rstrip('\n'))
else:
if line == marker_begin:
raise Exception('{0}: encountered BEGIN again before END'.format(ref))
elif line == marker_end:
started = False
excluded_blocks += 1
else:
continue
if started:
raise Exception('encountered EOF before END')
print('{0} EXCLUDE_FROM_DOCS blocks removed.'.format(excluded_blocks))
with open(path, 'w') as f:
f.write('\n'.join(new_lines))
def insert_title(path, title):
"""Inserts title in Jekyll metadata format to the file."""
prepend_file(path, '---\ntitle: "{0}"\n---\n\n'.format(title))
def insert_do_not_update(path):
notice = '<!--' + '\n' * 15 + 'DO NOT UPDATE THIS FILE!\n\n' \
+ 'Submit a patch to https://github.com/kubernetes/examples and\n' \
+ 'once it is merged, run ./update-imported-tutorials.sh to\n' \
+ 'import it to the website.' + '\n' * 15 + '-->\n\n'
prepend_file(path, notice)
def prepend_file(path, ss):
with open(path, 'r') as f:
for line in f:
ss += line
with open(path, 'w') as f:
f.write(ss)
if __name__ == '__main__':
main()