From 941f8d1ce4461a0549d8c24679d63f3ce0065bca Mon Sep 17 00:00:00 2001 From: Linus Lee <708863861@qq.com> Date: Mon, 26 Nov 2018 19:08:04 +0800 Subject: [PATCH] zh_Trans: Fix preview issue (#11311) * zh_trans: kubeadm-upgrade-1-12.md * update file * Update _index.md * Delete _index.md * Update kubeadm-upgrade-1-12.md * zh_trans: docs/reference/setup-tools/kubeadm/generated/kubeadm_config.md * Update kubeadm_config.md * zh_trans: fix Preview * zh_trans: fix Preview --- .../reference/glossary/aggregation-layer.md | 20 +++ .../zh/docs/reference/glossary/approver.md | 18 ++ .../glossary/cloud-controller-manager.md | 20 +++ .../zh/docs/reference/glossary/developer.md | 19 ++ content/zh/docs/reference/glossary/docker.md | 18 ++ .../zh/docs/reference/glossary/downstream.md | 19 ++ .../glossary/dynamic-volume-provisioning.md | 19 ++ .../zh/docs/reference/glossary/flexvolume.md | 22 +++ .../zh/docs/reference/glossary/helm-chart.md | 19 ++ .../glossary/horizontal-pod-autoscaler.md | 18 ++ content/zh/docs/reference/glossary/image.md | 18 ++ .../docs/reference/glossary/init-container.md | 18 ++ content/zh/docs/reference/glossary/istio.md | 20 +++ content/zh/docs/reference/glossary/job.md | 20 +++ content/zh/docs/reference/glossary/kops.md | 28 +++ .../glossary/kube-controller-manager.md | 19 ++ .../zh/docs/reference/glossary/kube-proxy.md | 19 ++ .../docs/reference/glossary/kube-scheduler.md | 18 ++ content/zh/docs/reference/glossary/kubectl.md | 19 ++ content/zh/docs/reference/glossary/kubelet.md | 19 ++ .../docs/reference/glossary/kubernetes-api.md | 19 ++ .../zh/docs/reference/glossary/minikube.md | 19 ++ content/zh/docs/reference/glossary/name.md | 18 ++ .../docs/reference/glossary/network-policy.md | 20 +++ .../glossary/persistent-volume-claim.md | 19 ++ .../reference/glossary/platform-developer.md | 18 ++ content/zh/docs/reference/glossary/pod.md | 19 ++ .../zh/docs/reference/glossary/podpreset.md | 18 ++ .../zh/docs/reference/glossary/quantity.md | 65 +++++++ content/zh/docs/reference/glossary/rbac.md | 19 ++ .../zh/docs/reference/glossary/replica-set.md | 20 +++ .../docs/reference/glossary/resource-quota.md | 20 +++ content/zh/docs/reference/glossary/secret.md | 19 ++ .../reference/glossary/security-context.md | 18 ++ .../reference/glossary/service-account.md | 19 ++ content/zh/docs/reference/glossary/service.md | 19 ++ content/zh/docs/reference/glossary/uid.md | 18 ++ .../docs/reference/glossary/volume-plugin.md | 19 ++ .../cassandra/cassandra-service.yaml | 12 ++ .../cassandra/cassandra-statefulset.yaml | 100 +++++++++++ .../application/deployment-patch.yaml | 21 +++ .../application/deployment-scale.yaml | 19 ++ .../application/deployment-update.yaml | 19 ++ .../zh/examples/application/deployment.yaml | 19 ++ .../guestbook/frontend-deployment.yaml | 38 ++++ .../guestbook/frontend-service.yaml | 18 ++ .../guestbook/redis-master-deployment.yaml | 29 +++ .../guestbook/redis-master-service.yaml | 16 ++ .../guestbook/redis-slave-deployment.yaml | 40 +++++ .../guestbook/redis-slave-service.yaml | 15 ++ .../examples/application/hpa/php-apache.yaml | 13 ++ .../zh/examples/application/job/cronjob.yaml | 18 ++ .../zh/examples/application/job/job-tmpl.yaml | 18 ++ .../examples/application/job/redis/Dockerfile | 6 + .../application/job/redis/redis-pod.yaml | 15 ++ .../application/job/redis/redis-service.yaml | 10 ++ .../examples/application/job/redis/rediswq.py | 130 ++++++++++++++ .../application/mysql/mysql-configmap.yaml | 16 ++ .../application/mysql/mysql-deployment.yaml | 43 +++++ .../examples/application/mysql/mysql-pv.yaml | 26 +++ .../application/mysql/mysql-services.yaml | 30 ++++ .../application/mysql/mysql-statefulset.yaml | 167 ++++++++++++++++++ .../zh/examples/application/nginx-app.yaml | 34 ++++ .../application/nginx-with-request.yaml | 23 +++ .../application/nginx/nginx-deployment.yaml | 19 ++ .../examples/application/nginx/nginx-svc.yaml | 12 ++ .../zh/examples/application/shell-demo.yaml | 14 ++ .../application/simple_deployment.yaml | 19 ++ .../application/update_deployment.yaml | 18 ++ .../application/web/web-parallel.yaml | 47 +++++ content/zh/examples/application/web/web.yaml | 47 +++++ .../wordpress/mysql-deployment.yaml | 65 +++++++ .../wordpress/wordpress-deployment.yaml | 67 +++++++ .../application/zookeeper/zookeeper.yaml | 133 ++++++++++++++ 74 files changed, 2112 insertions(+) create mode 100644 content/zh/docs/reference/glossary/aggregation-layer.md create mode 100755 content/zh/docs/reference/glossary/approver.md create mode 100755 content/zh/docs/reference/glossary/cloud-controller-manager.md create mode 100755 content/zh/docs/reference/glossary/developer.md create mode 100755 content/zh/docs/reference/glossary/docker.md create mode 100755 content/zh/docs/reference/glossary/downstream.md create mode 100755 content/zh/docs/reference/glossary/dynamic-volume-provisioning.md create mode 100644 content/zh/docs/reference/glossary/flexvolume.md create mode 100755 content/zh/docs/reference/glossary/helm-chart.md create mode 100755 content/zh/docs/reference/glossary/horizontal-pod-autoscaler.md create mode 100755 content/zh/docs/reference/glossary/image.md create mode 100755 content/zh/docs/reference/glossary/init-container.md create mode 100755 content/zh/docs/reference/glossary/istio.md create mode 100755 content/zh/docs/reference/glossary/job.md create mode 100755 content/zh/docs/reference/glossary/kops.md create mode 100755 content/zh/docs/reference/glossary/kube-controller-manager.md create mode 100755 content/zh/docs/reference/glossary/kube-proxy.md create mode 100755 content/zh/docs/reference/glossary/kube-scheduler.md create mode 100755 content/zh/docs/reference/glossary/kubectl.md create mode 100755 content/zh/docs/reference/glossary/kubelet.md create mode 100755 content/zh/docs/reference/glossary/kubernetes-api.md create mode 100755 content/zh/docs/reference/glossary/minikube.md create mode 100755 content/zh/docs/reference/glossary/name.md create mode 100755 content/zh/docs/reference/glossary/network-policy.md create mode 100755 content/zh/docs/reference/glossary/persistent-volume-claim.md create mode 100755 content/zh/docs/reference/glossary/platform-developer.md create mode 100755 content/zh/docs/reference/glossary/pod.md create mode 100755 content/zh/docs/reference/glossary/podpreset.md create mode 100644 content/zh/docs/reference/glossary/quantity.md create mode 100755 content/zh/docs/reference/glossary/rbac.md create mode 100755 content/zh/docs/reference/glossary/replica-set.md create mode 100755 content/zh/docs/reference/glossary/resource-quota.md create mode 100755 content/zh/docs/reference/glossary/secret.md create mode 100755 content/zh/docs/reference/glossary/security-context.md create mode 100755 content/zh/docs/reference/glossary/service-account.md create mode 100755 content/zh/docs/reference/glossary/service.md create mode 100755 content/zh/docs/reference/glossary/uid.md create mode 100755 content/zh/docs/reference/glossary/volume-plugin.md create mode 100644 content/zh/examples/application/cassandra/cassandra-service.yaml create mode 100644 content/zh/examples/application/cassandra/cassandra-statefulset.yaml create mode 100644 content/zh/examples/application/deployment-patch.yaml create mode 100644 content/zh/examples/application/deployment-scale.yaml create mode 100644 content/zh/examples/application/deployment-update.yaml create mode 100644 content/zh/examples/application/deployment.yaml create mode 100644 content/zh/examples/application/guestbook/frontend-deployment.yaml create mode 100644 content/zh/examples/application/guestbook/frontend-service.yaml create mode 100644 content/zh/examples/application/guestbook/redis-master-deployment.yaml create mode 100644 content/zh/examples/application/guestbook/redis-master-service.yaml create mode 100644 content/zh/examples/application/guestbook/redis-slave-deployment.yaml create mode 100644 content/zh/examples/application/guestbook/redis-slave-service.yaml create mode 100644 content/zh/examples/application/hpa/php-apache.yaml create mode 100644 content/zh/examples/application/job/cronjob.yaml create mode 100644 content/zh/examples/application/job/job-tmpl.yaml create mode 100644 content/zh/examples/application/job/redis/Dockerfile create mode 100644 content/zh/examples/application/job/redis/redis-pod.yaml create mode 100644 content/zh/examples/application/job/redis/redis-service.yaml create mode 100644 content/zh/examples/application/job/redis/rediswq.py create mode 100644 content/zh/examples/application/mysql/mysql-configmap.yaml create mode 100644 content/zh/examples/application/mysql/mysql-deployment.yaml create mode 100644 content/zh/examples/application/mysql/mysql-pv.yaml create mode 100644 content/zh/examples/application/mysql/mysql-services.yaml create mode 100644 content/zh/examples/application/mysql/mysql-statefulset.yaml create mode 100644 content/zh/examples/application/nginx-app.yaml create mode 100644 content/zh/examples/application/nginx-with-request.yaml create mode 100644 content/zh/examples/application/nginx/nginx-deployment.yaml create mode 100644 content/zh/examples/application/nginx/nginx-svc.yaml create mode 100644 content/zh/examples/application/shell-demo.yaml create mode 100644 content/zh/examples/application/simple_deployment.yaml create mode 100644 content/zh/examples/application/update_deployment.yaml create mode 100644 content/zh/examples/application/web/web-parallel.yaml create mode 100644 content/zh/examples/application/web/web.yaml create mode 100644 content/zh/examples/application/wordpress/mysql-deployment.yaml create mode 100644 content/zh/examples/application/wordpress/wordpress-deployment.yaml create mode 100644 content/zh/examples/application/zookeeper/zookeeper.yaml diff --git a/content/zh/docs/reference/glossary/aggregation-layer.md b/content/zh/docs/reference/glossary/aggregation-layer.md new file mode 100644 index 0000000000..d97b34d16d --- /dev/null +++ b/content/zh/docs/reference/glossary/aggregation-layer.md @@ -0,0 +1,20 @@ +--- +title: Aggregation Layer +id: aggregation-layer +date: 2018-10-08 +full_link: /docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation/ +short_description: > + The aggregation layer lets you install additional Kubernetes-style APIs in your cluster. + +aka: +tags: +- architecture +- extension +- operation +--- + The aggregation layer lets you install additional Kubernetes-style APIs in your cluster. + + + +When you've configured the {{< glossary_tooltip text="Kubernetes API Server" term_id="kube-apiserver" >}} to [support additional APIs](https://kubernetes.io/docs/tasks/access-kubernetes-api/configure-aggregation-layer/), you can add `APIService` objects to "claim" a URL path in the Kubernetes API. + diff --git a/content/zh/docs/reference/glossary/approver.md b/content/zh/docs/reference/glossary/approver.md new file mode 100755 index 0000000000..32dcd83373 --- /dev/null +++ b/content/zh/docs/reference/glossary/approver.md @@ -0,0 +1,18 @@ +--- +title: Approver +id: approver +date: 2018-04-12 +full_link: +short_description: > + A person who can review and approve Kubernetes code contributions. + +aka: +tags: +- community +--- + A person who can review and approve Kubernetes code contributions. + + + +While code review is focused on code quality and correctness, approval is focused on the holistic acceptance of a contribution. Holistic acceptance includes backwards/forwards compatibility, adhering to API and flag conventions, subtle performance and correctness issues, interactions with other parts of the system, and others. Approver status is scoped to a part of the codebase. Approvers were previously referred to as maintainers. + diff --git a/content/zh/docs/reference/glossary/cloud-controller-manager.md b/content/zh/docs/reference/glossary/cloud-controller-manager.md new file mode 100755 index 0000000000..0962c0c359 --- /dev/null +++ b/content/zh/docs/reference/glossary/cloud-controller-manager.md @@ -0,0 +1,20 @@ +--- +title: Cloud Controller Manager +id: cloud-controller-manager +date: 2018-04-12 +full_link: https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/ +short_description: > + Cloud Controller Manager is an alpha feature in 1.8. In upcoming releases it will be the preferred way to integrate Kubernetes with any cloud. + +aka: +tags: +- core-object +- architecture +- operation +--- + Cloud Controller Manager is an alpha feature in 1.8. In upcoming releases it will be the preferred way to integrate Kubernetes with any cloud. + + + +Kubernetes v1.6 contains a new binary called cloud-controller-manager. cloud-controller-manager is a daemon that embeds cloud-specific control loops. These cloud-specific control loops were originally in the kube-controller-manager. Since cloud providers develop and release at a different pace compared to the Kubernetes project, abstracting the provider-specific code to the cloud-controller-manager binary allows cloud vendors to evolve independently from the core Kubernetes code. + diff --git a/content/zh/docs/reference/glossary/developer.md b/content/zh/docs/reference/glossary/developer.md new file mode 100755 index 0000000000..1e0c8bd10e --- /dev/null +++ b/content/zh/docs/reference/glossary/developer.md @@ -0,0 +1,19 @@ +--- +title: Developer (disambiguation) +id: developer +date: 2018-04-12 +full_link: +short_description: > + May refer to: Application Developer, Code Contributor, or Platform Developer. + +aka: +tags: +- community +- user-type +--- + May refer to: {{< glossary_tooltip text="Application Developer" term_id="application-developer" >}}, {{< glossary_tooltip text="Code Contributor" term_id="code-contributor" >}}, or {{< glossary_tooltip text="Platform Developer" term_id="platform-developer" >}}. + + + +This overloaded term may have different meanings depending on the context + diff --git a/content/zh/docs/reference/glossary/docker.md b/content/zh/docs/reference/glossary/docker.md new file mode 100755 index 0000000000..639f568790 --- /dev/null +++ b/content/zh/docs/reference/glossary/docker.md @@ -0,0 +1,18 @@ +--- +title: docker +id: docker +date: 2018-04-12 +full_link: /docs/reference/kubectl/docker-cli-to-kubectl/ +short_description: > + Docker is a software technology providing operating-system-level virtualization also known as containers. + +aka: +tags: +- fundamental +--- + Docker is a software technology providing operating-system-level virtualization also known as containers. + + + +Docker uses the resource isolation features of the Linux kernel such as cgroups and kernel namespaces, and a union-capable file system such as OverlayFS and others to allow independent "containers" to run within a single Linux instance, avoiding the overhead of starting and maintaining virtual machines (VMs). + diff --git a/content/zh/docs/reference/glossary/downstream.md b/content/zh/docs/reference/glossary/downstream.md new file mode 100755 index 0000000000..f5b010f40d --- /dev/null +++ b/content/zh/docs/reference/glossary/downstream.md @@ -0,0 +1,19 @@ +--- +title: Downstream (disambiguation) +id: downstream +date: 2018-04-12 +full_link: +short_description: > + May refer to: code in the Kubernetes ecosystem that depends upon the core Kubernetes codebase or a forked repo. + +aka: +tags: +- community +--- + May refer to: code in the Kubernetes ecosystem that depends upon the core Kubernetes codebase or a forked repo. + + + +* In the **Kubernetes Community**: Conversations often use *downstream* to mean the ecosystem, code, or third-party tools that rely on the core Kubernetes codebase. For example, a new feature in Kubernetes may be adopted by applications *downstream* to improve their functionality. +* In **GitHub** or **git**: The convention is to refer to a forked repo as *downstream*, whereas the source repo is considered *upstream*. + diff --git a/content/zh/docs/reference/glossary/dynamic-volume-provisioning.md b/content/zh/docs/reference/glossary/dynamic-volume-provisioning.md new file mode 100755 index 0000000000..fd5c150e92 --- /dev/null +++ b/content/zh/docs/reference/glossary/dynamic-volume-provisioning.md @@ -0,0 +1,19 @@ +--- +title: Dynamic Volume Provisioning +id: dynamicvolumeprovisioning +date: 2018-04-12 +full_link: /docs/concepts/storage/dynamic-provisioning +short_description: > + Allows users to request automatic creation of storage Volumes. + +aka: +tags: +- core-object +- storage +--- + Allows users to request automatic creation of storage {{< glossary_tooltip text="Volumes" term_id="volume" >}}. + + + +Dynamic provisioning eliminates the need for cluster administrators to pre-provision storage. Instead, it automatically provisions storage by user request. Dynamic volume provisioning is based on an API object, {{< glossary_tooltip text="StorageClass" term_id="storage-class" >}}, referring to a {{< glossary_tooltip text="Volume Plugin" term_id="volume-plugin" >}} that provisions a {{< glossary_tooltip text="Volume" term_id="volume" >}} and the set of parameters to pass to the Volume Plugin. + diff --git a/content/zh/docs/reference/glossary/flexvolume.md b/content/zh/docs/reference/glossary/flexvolume.md new file mode 100644 index 0000000000..612c1abed1 --- /dev/null +++ b/content/zh/docs/reference/glossary/flexvolume.md @@ -0,0 +1,22 @@ +--- +title: Flexvolume +id: flexvolume +date: 2018-06-25 +full_link: https://kubernetes.io/docs/concepts/storage/volumes/#flexvolume +short_description: > + Flexvolume is an interface for creating out-of-tree volume plugins. The {{< glossary_tooltip text="Container Storage Interface" term_id="csi" >}} is a newer interface which addresses several problems with Flexvolumes. + + +aka: +tags: +- storage +--- + Flexvolume is an interface for creating out-of-tree volume plugins. The {{< glossary_tooltip text="Container Storage Interface" term_id="csi" >}} is a newer interface which addresses several problems with Flexvolumes. + + + +Flexvolumes enable users to write their own drivers and add support for their volumes in Kubernetes. FlexVolume driver binaries and dependencies must be installed on host machines. This requires root access. The Storage SIG suggests implementing a {{< glossary_tooltip text="CSI" term_id="csi" >}} driver if possible since it addresses the limitations with Flexvolumes. + +* [Flexvolume in the Kubernetes documentation](https://kubernetes.io/docs/concepts/storage/volumes/#flexvolume) +* [More information on Flexvolumes](https://github.com/kubernetes/community/blob/master/contributors/devel/flexvolume.md) +* [Volume Plugin FAQ for Storage Vendors](https://github.com/kubernetes/community/blob/master/sig-storage/volume-plugin-faq.md) diff --git a/content/zh/docs/reference/glossary/helm-chart.md b/content/zh/docs/reference/glossary/helm-chart.md new file mode 100755 index 0000000000..6fd83bff50 --- /dev/null +++ b/content/zh/docs/reference/glossary/helm-chart.md @@ -0,0 +1,19 @@ +--- +title: Helm Chart +id: helm-chart +date: 2018-04-12 +full_link: https://github.com/kubernetes/helm/blob/master/docs/charts.md +short_description: > + A package of pre-configured Kubernetes resources that can be managed with the Helm tool. + +aka: +tags: +- tool +--- + A package of pre-configured Kubernetes resources that can be managed with the Helm tool. + + + +Charts provide a reproducible way of creating and sharing Kubernetes applications. +A single chart can be used to deploy something simple, like a memcached Pod, or something complex, like a full web app stack with HTTP servers, databases, caches, and so on. + diff --git a/content/zh/docs/reference/glossary/horizontal-pod-autoscaler.md b/content/zh/docs/reference/glossary/horizontal-pod-autoscaler.md new file mode 100755 index 0000000000..a82df528a4 --- /dev/null +++ b/content/zh/docs/reference/glossary/horizontal-pod-autoscaler.md @@ -0,0 +1,18 @@ +--- +title: Horizontal Pod Autoscaler +id: horizontal-pod-autoscaler +date: 2018-04-12 +full_link: /docs/tasks/run-application/horizontal-pod-autoscale/ +short_description: > + An API resource that automatically scales the number of pod replicas based on targeted CPU utilization or custom metric targets. + +aka: +tags: +- operation +--- + An API resource that automatically scales the number of pod replicas based on targeted CPU utilization or custom metric targets. + + + +HPA is typically used with {{< glossary_tooltip text="Replication Controllers" term_id="replication-controller" >}}, {{< glossary_tooltip text="Deployments" term_id="deployment" >}}, or Replica Sets. It cannot be applied to objects that cannot be scaled, for example {{< glossary_tooltip text="DaemonSets" term_id="daemonset" >}}. + diff --git a/content/zh/docs/reference/glossary/image.md b/content/zh/docs/reference/glossary/image.md new file mode 100755 index 0000000000..cdb2c7e02c --- /dev/null +++ b/content/zh/docs/reference/glossary/image.md @@ -0,0 +1,18 @@ +--- +title: Image +id: image +date: 2018-04-12 +full_link: +short_description: > + Stored instance of a container that holds a set of software needed to run an application. + +aka: +tags: +- fundamental +--- + Stored instance of a container that holds a set of software needed to run an application. + + + +A way of packaging software that allows it to be stored in a container registry, pulled to a local system, and run as an application. Meta data is included in the image that can indicate what executable to run, who built it, and other information. + diff --git a/content/zh/docs/reference/glossary/init-container.md b/content/zh/docs/reference/glossary/init-container.md new file mode 100755 index 0000000000..2ea793661c --- /dev/null +++ b/content/zh/docs/reference/glossary/init-container.md @@ -0,0 +1,18 @@ +--- +title: Init Container +id: init-container +date: 2018-04-12 +full_link: +short_description: > + One or more initialization containers that must run to completion before any app containers run. + +aka: +tags: +- fundamental +--- + One or more initialization containers that must run to completion before any app containers run. + + + +Initialization (init) containers are like regular app containers, with one difference: init containers must run to completion before any app containers can start. Init containers run in series: each init container must run to completion before the next init container begins. + diff --git a/content/zh/docs/reference/glossary/istio.md b/content/zh/docs/reference/glossary/istio.md new file mode 100755 index 0000000000..246d53bb15 --- /dev/null +++ b/content/zh/docs/reference/glossary/istio.md @@ -0,0 +1,20 @@ +--- +title: Istio +id: istio +date: 2018-04-12 +full_link: https://istio.io/docs/concepts/what-is-istio/overview.html +short_description: > + An open platform (not Kubernetes-specific) that provides a uniform way to integrate microservices, manage traffic flow, enforce policies, and aggregate telemetry data. + +aka: +tags: +- networking +- architecture +- extension +--- + An open platform (not Kubernetes-specific) that provides a uniform way to integrate microservices, manage traffic flow, enforce policies, and aggregate telemetry data. + + + +Adding Istio does not require changing application code. It is a layer of infrastructure between a service and the network, which when combined with service deployments, is commonly referred to as a service mesh. Istio's control plane abstracts away the underlying cluster management platform, which may be Kubernetes, Mesosphere, etc. + diff --git a/content/zh/docs/reference/glossary/job.md b/content/zh/docs/reference/glossary/job.md new file mode 100755 index 0000000000..af8cfa0c37 --- /dev/null +++ b/content/zh/docs/reference/glossary/job.md @@ -0,0 +1,20 @@ +--- +title: Job +id: job +date: 2018-04-12 +full_link: /docs/concepts/workloads/controllers/jobs-run-to-completion +short_description: > + A finite or batch task that runs to completion. + +aka: +tags: +- fundamental +- core-object +- workload +--- + A finite or batch task that runs to completion. + + + +Creates one or more {{< glossary_tooltip term_id="pod" >}} objects and ensures that a specified number of them successfully terminate. As Pods successfully complete, the Job tracks the successful completions. + diff --git a/content/zh/docs/reference/glossary/kops.md b/content/zh/docs/reference/glossary/kops.md new file mode 100755 index 0000000000..c52be78809 --- /dev/null +++ b/content/zh/docs/reference/glossary/kops.md @@ -0,0 +1,28 @@ +--- +title: Kops +id: kops +date: 2018-04-12 +full_link: /docs/getting-started-guides/kops/ +short_description: > + A CLI tool that helps you create, destroy, upgrade and maintain production-grade, highly available, Kubernetes clusters. *NOTE: Officially supports AWS only, with GCE and VMware vSphere in alpha*. + +aka: +tags: +- tool +- operation +--- + A CLI tool that helps you create, destroy, upgrade and maintain production-grade, highly available, Kubernetes clusters. *NOTE: Officially supports AWS only, with GCE and VMware vSphere in alpha*. + + + +`kops` provisions your cluster with: + + * Fully automated installation + * DNS-based cluster identification + * Self-healing: everything runs in Auto-Scaling Groups + * Limited OS support (Debian preferred, Ubuntu 16.04 supported, early support for CentOS & RHEL) + * High availability (HA) support + * The ability to directly provision, or generate terraform manifests + +You can also build your own cluster using {{< glossary_tooltip term_id="kubeadm" >}} as a building block. `kops` builds on the kubeadm work. + diff --git a/content/zh/docs/reference/glossary/kube-controller-manager.md b/content/zh/docs/reference/glossary/kube-controller-manager.md new file mode 100755 index 0000000000..0b039ae536 --- /dev/null +++ b/content/zh/docs/reference/glossary/kube-controller-manager.md @@ -0,0 +1,19 @@ +--- +title: kube-controller-manager +id: kube-controller-manager +date: 2018-04-12 +full_link: /docs/reference/generated/kube-controller-manager/ +short_description: > + Component on the master that runs controllers. + +aka: +tags: +- architecture +- fundamental +--- + Component on the master that runs {{< glossary_tooltip text="controllers" term_id="controller" >}}. + + + +Logically, each {{< glossary_tooltip text="controller" term_id="controller" >}} is a separate process, but to reduce complexity, they are all compiled into a single binary and run in a single process. + diff --git a/content/zh/docs/reference/glossary/kube-proxy.md b/content/zh/docs/reference/glossary/kube-proxy.md new file mode 100755 index 0000000000..4616c4ee71 --- /dev/null +++ b/content/zh/docs/reference/glossary/kube-proxy.md @@ -0,0 +1,19 @@ +--- +title: kube-proxy +id: kube-proxy +date: 2018-04-12 +full_link: /docs/reference/generated/kube-proxy +short_description: > + `kube-proxy` is a network proxy that runs on each node in the cluster. + +aka: +tags: +- fundamental +- core-object +--- + `kube-proxy` is a network proxy that runs on each node in the cluster. + + + +`kube-proxy` is responsible for request forwarding. `kube-proxy` allows TCP and UDP stream forwarding or round robin TCP and UDP forwarding across a set of backend functions. + diff --git a/content/zh/docs/reference/glossary/kube-scheduler.md b/content/zh/docs/reference/glossary/kube-scheduler.md new file mode 100755 index 0000000000..b9672b6e03 --- /dev/null +++ b/content/zh/docs/reference/glossary/kube-scheduler.md @@ -0,0 +1,18 @@ +--- +title: kube-scheduler +id: kube-scheduler +date: 2018-04-12 +full_link: /docs/reference/generated/kube-scheduler/ +short_description: > + Component on the master that watches newly created pods that have no node assigned, and selects a node for them to run on. + +aka: +tags: +- architecture +--- + Component on the master that watches newly created pods that have no node assigned, and selects a node for them to run on. + + + +Factors taken into account for scheduling decisions include individual and collective resource requirements, hardware/software/policy constraints, affinity and anti-affinity specifications, data locality, inter-workload interference and deadlines. + diff --git a/content/zh/docs/reference/glossary/kubectl.md b/content/zh/docs/reference/glossary/kubectl.md new file mode 100755 index 0000000000..665fffcf98 --- /dev/null +++ b/content/zh/docs/reference/glossary/kubectl.md @@ -0,0 +1,19 @@ +--- +title: Kubectl +id: kubectl +date: 2018-04-12 +full_link: /docs/user-guide/kubectl-overview/ +short_description: > + A command line tool for communicating with a Kubernetes API server. + +aka: +tags: +- tool +- fundamental +--- + A command line tool for communicating with a {{< glossary_tooltip text="Kubernetes API" term_id="kubernetes-api" >}} server. + + + +You can use kubectl to create, inspect, update, and delete Kubernetes objects. + diff --git a/content/zh/docs/reference/glossary/kubelet.md b/content/zh/docs/reference/glossary/kubelet.md new file mode 100755 index 0000000000..0c4ea9425a --- /dev/null +++ b/content/zh/docs/reference/glossary/kubelet.md @@ -0,0 +1,19 @@ +--- +title: Kubelet +id: kubelet +date: 2018-04-12 +full_link: /docs/reference/generated/kubelet +short_description: > + An agent that runs on each node in the cluster. It makes sure that containers are running in a pod. + +aka: +tags: +- fundamental +- core-object +--- + An agent that runs on each node in the cluster. It makes sure that containers are running in a pod. + + + +The kubelet takes a set of PodSpecs that are provided through various mechanisms and ensures that the containers described in those PodSpecs are running and healthy. The kubelet doesn’t manage containers which were not created by Kubernetes. + diff --git a/content/zh/docs/reference/glossary/kubernetes-api.md b/content/zh/docs/reference/glossary/kubernetes-api.md new file mode 100755 index 0000000000..80f08ed5be --- /dev/null +++ b/content/zh/docs/reference/glossary/kubernetes-api.md @@ -0,0 +1,19 @@ +--- +title: Kubernetes API +id: kubernetes-api +date: 2018-04-12 +full_link: /docs/concepts/overview/kubernetes-api/ +short_description: > + The application that serves Kubernetes functionality through a RESTful interface and stores the state of the cluster. + +aka: +tags: +- fundamental +- architecture +--- + The application that serves Kubernetes functionality through a RESTful interface and stores the state of the cluster. + + + +Kubernetes resources and "records of intent" are all stored as API objects, and modified via RESTful calls to the API. The API allows configuration to be managed in a declarative way. Users can interact with the Kubernetes API directly, or via tools like `kubectl`. The core Kubernetes API is flexible and can also be extended to support custom resources. + diff --git a/content/zh/docs/reference/glossary/minikube.md b/content/zh/docs/reference/glossary/minikube.md new file mode 100755 index 0000000000..26e47f3412 --- /dev/null +++ b/content/zh/docs/reference/glossary/minikube.md @@ -0,0 +1,19 @@ +--- +title: Minikube +id: minikube +date: 2018-04-12 +full_link: /docs/getting-started-guides/minikube/ +short_description: > + A tool for running Kubernetes locally. + +aka: +tags: +- fundamental +- tool +--- + A tool for running Kubernetes locally. + + + +Minikube runs a single-node cluster inside a VM on your computer. + diff --git a/content/zh/docs/reference/glossary/name.md b/content/zh/docs/reference/glossary/name.md new file mode 100755 index 0000000000..8fce1fb24e --- /dev/null +++ b/content/zh/docs/reference/glossary/name.md @@ -0,0 +1,18 @@ +--- +title: Name +id: name +date: 2018-04-12 +full_link: /docs/concepts/overview/working-with-objects/names +short_description: > + A client-provided string that refers to an object in a resource URL, such as `/api/v1/pods/some-name`. + +aka: +tags: +- fundamental +--- + A client-provided string that refers to an object in a resource URL, such as `/api/v1/pods/some-name`. + + + +Only one object of a given kind can have a given name at a time. However, if you delete the object, you can make a new object with the same name. + diff --git a/content/zh/docs/reference/glossary/network-policy.md b/content/zh/docs/reference/glossary/network-policy.md new file mode 100755 index 0000000000..8fb33b666a --- /dev/null +++ b/content/zh/docs/reference/glossary/network-policy.md @@ -0,0 +1,20 @@ +--- +title: Network Policy +id: network-policy +date: 2018-04-12 +full_link: /docs/concepts/services-networking/network-policies/ +short_description: > + A specification of how groups of Pods are allowed to communicate with each other and with other network endpoints. + +aka: +tags: +- networking +- architecture +- extension +--- + A specification of how groups of Pods are allowed to communicate with each other and with other network endpoints. + + + +Network Policies help you declaratively configure which Pods are allowed to connect to each other, which namespaces are allowed to communicate, and more specifically which port numbers to enforce each policy on. `NetworkPolicy` resources use labels to select Pods and define rules which specify what traffic is allowed to the selected Pods. Network Policies are implemented by a supported network plugin provided by a network provider. Be aware that creating a network resource without a controller to implement it will have no effect. + diff --git a/content/zh/docs/reference/glossary/persistent-volume-claim.md b/content/zh/docs/reference/glossary/persistent-volume-claim.md new file mode 100755 index 0000000000..dc6314d887 --- /dev/null +++ b/content/zh/docs/reference/glossary/persistent-volume-claim.md @@ -0,0 +1,19 @@ +--- +title: Persistent Volume Claim +id: persistent-volume-claim +date: 2018-04-12 +full_link: /docs/concepts/storage/persistent-volumes/ +short_description: > + Claims storage resources defined in a PersistentVolume so that it can be mounted as a volume in a container. + +aka: +tags: +- core-object +- storage +--- + Claims storage resources defined in a PersistentVolume so that it can be mounted as a volume in a container. + + + +Specifies the amount of storage, how the storage will be accessed (read-only, read-write and/or exclusive) and how it is reclaimed (retained, recycled or deleted). Details of the storage itself are in the PersistentVolume specification. + diff --git a/content/zh/docs/reference/glossary/platform-developer.md b/content/zh/docs/reference/glossary/platform-developer.md new file mode 100755 index 0000000000..ed9a5fa1b7 --- /dev/null +++ b/content/zh/docs/reference/glossary/platform-developer.md @@ -0,0 +1,18 @@ +--- +title: Platform Developer +id: platform-developer +date: 2018-04-12 +full_link: +short_description: > + A person who customizes the Kubernetes platform to fit the needs of their project. + +aka: +tags: +- user-type +--- + A person who customizes the Kubernetes platform to fit the needs of their project. + + + +A platform developer may, for example, use [Custom Resources](/docs/concepts/api-extension/custom-resources/) or [Extend the Kubernetes API with the aggregation layer](/docs/concepts/api-extension/apiserver-aggregation/) to add functionality to their instance of Kubernetes, specifically for their application. Some Platform Developers are also {{< glossary_tooltip text="contributors" term_id="contributor" >}} and develop extensions which are contributed to the Kubernetes community. Others develop closed-source commercial or site-specific extensions. + diff --git a/content/zh/docs/reference/glossary/pod.md b/content/zh/docs/reference/glossary/pod.md new file mode 100755 index 0000000000..fcd62f4423 --- /dev/null +++ b/content/zh/docs/reference/glossary/pod.md @@ -0,0 +1,19 @@ +--- +title: Pod +id: pod +date: 2018-04-12 +full_link: /docs/concepts/workloads/pods/pod-overview/ +short_description: > + The smallest and simplest Kubernetes object. A Pod represents a set of running containers on your cluster. + +aka: +tags: +- core-object +- fundamental +--- + The smallest and simplest Kubernetes object. A Pod represents a set of running {{< glossary_tooltip text="containers" term_id="container" >}} on your cluster. + + + +A Pod is typically set up to run a single primary container. It can also run optional sidecar containers that add supplementary features like logging. Pods are commonly managed by a {{< glossary_tooltip term_id="deployment" >}}. + diff --git a/content/zh/docs/reference/glossary/podpreset.md b/content/zh/docs/reference/glossary/podpreset.md new file mode 100755 index 0000000000..c60f03cd95 --- /dev/null +++ b/content/zh/docs/reference/glossary/podpreset.md @@ -0,0 +1,18 @@ +--- +title: PodPreset +id: podpreset +date: 2018-04-12 +full_link: +short_description: > + An API object that injects information such as secrets, volume mounts, and environment variables into pods at creation time. + +aka: +tags: +- operation +--- + An API object that injects information such as secrets, volume mounts, and environment variables into pods at creation time. + + + +This object chooses the pods to inject information into using standard selectors. This allows the podspec definitions to be nonspecific, decoupling the podspec from environment specific configuration. + diff --git a/content/zh/docs/reference/glossary/quantity.md b/content/zh/docs/reference/glossary/quantity.md new file mode 100644 index 0000000000..4bc243e0b9 --- /dev/null +++ b/content/zh/docs/reference/glossary/quantity.md @@ -0,0 +1,65 @@ +<<<<<<< HEAD +--- +title: Quantity +id: quantity +date: 2018-08-07 +full_link: +short_description: > + A whole-number representation of small or large numbers using SI suffixes. + +aka: +tags: +--- + A whole-number representation of small or large numbers using SI suffixes. + + + +Quantities are representations of small or large numbers using a compact, +whole-number notation with SI suffixes. Fractional numbers are represented +using milli-units, while large numbers can be represented using kilo-units, +mega-units, giga-units, etc. + +For instance, the number `1.5` is represented `1500m`, while the number `1000` +can be represented as `1k`, and `1000000` as `1M`. You can also specify +binary-notation suffixes; the number 2048 can be written as `2Ki`. + +The accepted decimal (power-of-10) units are `m` (milli), `k` (kilo, +intentionally lowercase), `M` (mega), `G` (giga), `T` (terra), `P` (peta), +`E` (exa). + +The accepted binary (power-of-2) units are `Ki` (kibi), `Mi` (mebi), `Gi` (gibi), +`Ti` (tebi), `Pi` (pebi), `Ei` (exbi). +||||||| merged common ancestors +======= +--- +title: Quantity +id: quantity +date: 2018-08-07 +full_link: +short_description: > + A whole-number representation of small or large numbers using SI suffixes. + +aka: +tags: +- core-object +--- + A whole-number representation of small or large numbers using SI suffixes. + + + +Quantities are representations of small or large numbers using a compact, +whole-number notation with SI suffixes. Fractional numbers are represented +using milli units, while large numbers can be represented using kilo, +mega, or giga units. + +For instance, the number `1.5` is represented as `1500m`, while the number `1000` +can be represented as `1k`, and `1000000` as `1M`. You can also specify +binary-notation suffixes; the number 2048 can be written as `2Ki`. + +The accepted decimal (power-of-10) units are `m` (milli), `k` (kilo, +intentionally lowercase), `M` (mega), `G` (giga), `T` (terra), `P` (peta), +`E` (exa). + +The accepted binary (power-of-2) units are `Ki` (kibi), `Mi` (mebi), `Gi` (gibi), +`Ti` (tebi), `Pi` (pebi), `Ei` (exbi). +>>>>>>> master diff --git a/content/zh/docs/reference/glossary/rbac.md b/content/zh/docs/reference/glossary/rbac.md new file mode 100755 index 0000000000..ff3dc7e747 --- /dev/null +++ b/content/zh/docs/reference/glossary/rbac.md @@ -0,0 +1,19 @@ +--- +title: RBAC (Role-Based Access Control) +id: rbac +date: 2018-04-12 +full_link: /docs/reference/access-authn-authz/rbac/ +short_description: > + Manages authorization decisions, allowing admins to dynamically configure access policies through the Kubernetes API. + +aka: +tags: +- security +- fundamental +--- + Manages authorization decisions, allowing admins to dynamically configure access policies through the {{< glossary_tooltip text="Kubernetes API" term_id="kubernetes-api" >}}. + + + +RBAC utilizes *roles*, which contain permission rules, and *role bindings*, which grant the permissions defined in a role to a set of users. + diff --git a/content/zh/docs/reference/glossary/replica-set.md b/content/zh/docs/reference/glossary/replica-set.md new file mode 100755 index 0000000000..0d53c9f31b --- /dev/null +++ b/content/zh/docs/reference/glossary/replica-set.md @@ -0,0 +1,20 @@ +--- +title: ReplicaSet +id: replica-set +date: 2018-04-12 +full_link: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/ +short_description: > + ReplicaSet is the next-generation Replication Controller. + +aka: +tags: +- fundamental +- core-object +- workload +--- + ReplicaSet is the next-generation Replication Controller. + + + +ReplicaSet, like ReplicationController, ensures that a specified number of pods replicas are running at one time. ReplicaSet supports the new set-based selector requirements as described in the labels user guide, whereas a Replication Controller only supports equality-based selector requirements. + diff --git a/content/zh/docs/reference/glossary/resource-quota.md b/content/zh/docs/reference/glossary/resource-quota.md new file mode 100755 index 0000000000..206791aa1c --- /dev/null +++ b/content/zh/docs/reference/glossary/resource-quota.md @@ -0,0 +1,20 @@ +--- +title: Resource Quotas +id: resource-quota +date: 2018-04-12 +full_link: /docs/concepts/policy/resource-quotas/ +short_description: > + Provides constraints that limit aggregate resource consumption per namespace. + +aka: +tags: +- fundamental +- operation +- architecture +--- + Provides constraints that limit aggregate resource consumption per {{< glossary_tooltip term_id="namespace" >}}. + + + +Limits the quantity of objects that can be created in a namespace by type, as well as the total amount of compute resources that may be consumed by resources in that project. + diff --git a/content/zh/docs/reference/glossary/secret.md b/content/zh/docs/reference/glossary/secret.md new file mode 100755 index 0000000000..e1290f8d7e --- /dev/null +++ b/content/zh/docs/reference/glossary/secret.md @@ -0,0 +1,19 @@ +--- +title: Secret +id: secret +date: 2018-04-12 +full_link: /docs/concepts/configuration/secret/ +short_description: > + Stores sensitive information, such as passwords, OAuth tokens, and ssh keys. + +aka: +tags: +- core-object +- security +--- + Stores sensitive information, such as passwords, OAuth tokens, and ssh keys. + + + +Allows for more control over how sensitive information is used and reduces the risk of accidental exposure, including [encryption](https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/#ensure-all-secrets-are-encrypted) at rest. A {{< glossary_tooltip text="Pod" term_id="pod" >}} references the secret as a file in a volume mount or by the kubelet pulling images for a pod. Secrets are great for confidential data and [ConfigMaps](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/) for non-confidential data. + diff --git a/content/zh/docs/reference/glossary/security-context.md b/content/zh/docs/reference/glossary/security-context.md new file mode 100755 index 0000000000..7bdf99534a --- /dev/null +++ b/content/zh/docs/reference/glossary/security-context.md @@ -0,0 +1,18 @@ +--- +title: Security Context +id: security-context +date: 2018-04-12 +full_link: /docs/tasks/configure-pod-container/security-context/ +short_description: > + The securityContext field defines privilege and access control settings for a Pod or Container, including the runtime UID and GID. + +aka: +tags: +- security +--- + The securityContext field defines privilege and access control settings for a Pod or Container, including the runtime UID and GID. + + + +The securityContext field in a {{< glossary_tooltip term_id="pod" >}} (applying to all containers) or container is used to set the user (runAsUser) and group (fsGroup), capabilities, privilege settings, and security policies (SELinux/AppArmor/Seccomp) that container processes use. + diff --git a/content/zh/docs/reference/glossary/service-account.md b/content/zh/docs/reference/glossary/service-account.md new file mode 100755 index 0000000000..f5d6854ad0 --- /dev/null +++ b/content/zh/docs/reference/glossary/service-account.md @@ -0,0 +1,19 @@ +--- +title: Service Account +id: service-account +date: 2018-04-12 +full_link: /docs/tasks/configure-pod-container/configure-service-account/ +short_description: > + Provides an identity for processes that run in a Pod. + +aka: +tags: +- fundamental +- core-object +--- + Provides an identity for processes that run in a {{< glossary_tooltip text="Pod" term_id="pod" >}}. + + + +When processes inside Pods access the cluster, they are authenticated by the API server as a particular service account, for example, `default`. When you create a Pod, if you do not specify a service account, it is automatically assigned the default service account in the same namespace {{< glossary_tooltip text="Namespace" term_id="namespace" >}}. + diff --git a/content/zh/docs/reference/glossary/service.md b/content/zh/docs/reference/glossary/service.md new file mode 100755 index 0000000000..75bb48e4eb --- /dev/null +++ b/content/zh/docs/reference/glossary/service.md @@ -0,0 +1,19 @@ +--- +title: Service +id: service +date: 2018-04-12 +full_link: /docs/concepts/services-networking/service/ +short_description: > + An API object that describes how to access applications, such as a set of Pods, and can describe ports and load-balancers. + +aka: +tags: +- fundamental +- core-object +--- + An API object that describes how to access applications, such as a set of {{< glossary_tooltip text="Pods" term_id="pod" >}}, and can describe ports and load-balancers. + + + +The access point can be internal or external to the cluster. + diff --git a/content/zh/docs/reference/glossary/uid.md b/content/zh/docs/reference/glossary/uid.md new file mode 100755 index 0000000000..2465cd09ca --- /dev/null +++ b/content/zh/docs/reference/glossary/uid.md @@ -0,0 +1,18 @@ +--- +title: UID +id: uid +date: 2018-04-12 +full_link: /docs/concepts/overview/working-with-objects/names +short_description: > + A Kubernetes systems-generated string to uniquely identify objects. + +aka: +tags: +- fundamental +--- + A Kubernetes systems-generated string to uniquely identify objects. + + + +Every object created over the whole lifetime of a Kubernetes cluster has a distinct UID. It is intended to distinguish between historical occurrences of similar entities. + diff --git a/content/zh/docs/reference/glossary/volume-plugin.md b/content/zh/docs/reference/glossary/volume-plugin.md new file mode 100755 index 0000000000..8fc1c7be52 --- /dev/null +++ b/content/zh/docs/reference/glossary/volume-plugin.md @@ -0,0 +1,19 @@ +--- +title: Volume Plugin +id: volumeplugin +date: 2018-04-12 +full_link: +short_description: > + A Volume Plugin enables integration of storage within a Pod. + +aka: +tags: +- core-object +- storage +--- + A Volume Plugin enables integration of storage within a {{< glossary_tooltip text="Pod" term_id="pod" >}}. + + + +A Volume Plugin lets you attach and mount storage volumes for use by a {{< glossary_tooltip text="Pod" term_id="pod" >}}. Volume plugins can be _in tree_ or _out of tree_. _In tree_ plugins are part of the Kubernetes code repository and follow its release cycle. _Out of tree_ plugins are developed independently. + diff --git a/content/zh/examples/application/cassandra/cassandra-service.yaml b/content/zh/examples/application/cassandra/cassandra-service.yaml new file mode 100644 index 0000000000..31bee74b58 --- /dev/null +++ b/content/zh/examples/application/cassandra/cassandra-service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: cassandra + name: cassandra +spec: + clusterIP: None + ports: + - port: 9042 + selector: + app: cassandra diff --git a/content/zh/examples/application/cassandra/cassandra-statefulset.yaml b/content/zh/examples/application/cassandra/cassandra-statefulset.yaml new file mode 100644 index 0000000000..a7bdbedc9c --- /dev/null +++ b/content/zh/examples/application/cassandra/cassandra-statefulset.yaml @@ -0,0 +1,100 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: cassandra + labels: + app: cassandra +spec: + serviceName: cassandra + replicas: 3 + selector: + matchLabels: + app: cassandra + template: + metadata: + labels: + app: cassandra + spec: + terminationGracePeriodSeconds: 1800 + containers: + - name: cassandra + image: gcr.io/google-samples/cassandra:v13 + imagePullPolicy: Always + ports: + - containerPort: 7000 + name: intra-node + - containerPort: 7001 + name: tls-intra-node + - containerPort: 7199 + name: jmx + - containerPort: 9042 + name: cql + resources: + limits: + cpu: "500m" + memory: 1Gi + requests: + cpu: "500m" + memory: 1Gi + securityContext: + capabilities: + add: + - IPC_LOCK + lifecycle: + preStop: + exec: + command: + - /bin/sh + - -c + - nodetool drain + env: + - name: MAX_HEAP_SIZE + value: 512M + - name: HEAP_NEWSIZE + value: 100M + - name: CASSANDRA_SEEDS + value: "cassandra-0.cassandra.default.svc.cluster.local" + - name: CASSANDRA_CLUSTER_NAME + value: "K8Demo" + - name: CASSANDRA_DC + value: "DC1-K8Demo" + - name: CASSANDRA_RACK + value: "Rack1-K8Demo" + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + readinessProbe: + exec: + command: + - /bin/bash + - -c + - /ready-probe.sh + initialDelaySeconds: 15 + timeoutSeconds: 5 + # These volume mounts are persistent. They are like inline claims, + # but not exactly because the names need to match exactly one of + # the stateful pod volumes. + volumeMounts: + - name: cassandra-data + mountPath: /cassandra_data + # These are converted to volume claims by the controller + # and mounted at the paths mentioned above. + # do not use these in production until ssd GCEPersistentDisk or other ssd pd + volumeClaimTemplates: + - metadata: + name: cassandra-data + spec: + accessModes: [ "ReadWriteOnce" ] + storageClassName: fast + resources: + requests: + storage: 1Gi +--- +kind: StorageClass +apiVersion: storage.k8s.io/v1 +metadata: + name: fast +provisioner: k8s.io/minikube-hostpath +parameters: + type: pd-ssd diff --git a/content/zh/examples/application/deployment-patch.yaml b/content/zh/examples/application/deployment-patch.yaml new file mode 100644 index 0000000000..7b32e2fcae --- /dev/null +++ b/content/zh/examples/application/deployment-patch.yaml @@ -0,0 +1,21 @@ +apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 +kind: Deployment +metadata: + name: patch-demo +spec: + replicas: 2 + selector: + matchLabels: + app: nginx + template: + metadata: + labels: + app: nginx + spec: + containers: + - name: patch-demo-ctr + image: nginx + tolerations: + - effect: NoSchedule + key: dedicated + value: test-team diff --git a/content/zh/examples/application/deployment-scale.yaml b/content/zh/examples/application/deployment-scale.yaml new file mode 100644 index 0000000000..3bdc7b6f5b --- /dev/null +++ b/content/zh/examples/application/deployment-scale.yaml @@ -0,0 +1,19 @@ +apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 +kind: Deployment +metadata: + name: nginx-deployment +spec: + selector: + matchLabels: + app: nginx + replicas: 4 # Update the replicas from 2 to 4 + template: + metadata: + labels: + app: nginx + spec: + containers: + - name: nginx + image: nginx:1.8 + ports: + - containerPort: 80 diff --git a/content/zh/examples/application/deployment-update.yaml b/content/zh/examples/application/deployment-update.yaml new file mode 100644 index 0000000000..8c683d6dc7 --- /dev/null +++ b/content/zh/examples/application/deployment-update.yaml @@ -0,0 +1,19 @@ +apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 +kind: Deployment +metadata: + name: nginx-deployment +spec: + selector: + matchLabels: + app: nginx + replicas: 2 + template: + metadata: + labels: + app: nginx + spec: + containers: + - name: nginx + image: nginx:1.8 # Update the version of nginx from 1.7.9 to 1.8 + ports: + - containerPort: 80 diff --git a/content/zh/examples/application/deployment.yaml b/content/zh/examples/application/deployment.yaml new file mode 100644 index 0000000000..0f526b16c0 --- /dev/null +++ b/content/zh/examples/application/deployment.yaml @@ -0,0 +1,19 @@ +apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 +kind: Deployment +metadata: + name: nginx-deployment +spec: + selector: + matchLabels: + app: nginx + replicas: 2 # tells deployment to run 2 pods matching the template + template: + metadata: + labels: + app: nginx + spec: + containers: + - name: nginx + image: nginx:1.7.9 + ports: + - containerPort: 80 diff --git a/content/zh/examples/application/guestbook/frontend-deployment.yaml b/content/zh/examples/application/guestbook/frontend-deployment.yaml new file mode 100644 index 0000000000..50d6e1f0d4 --- /dev/null +++ b/content/zh/examples/application/guestbook/frontend-deployment.yaml @@ -0,0 +1,38 @@ +apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 +kind: Deployment +metadata: + name: frontend + labels: + app: guestbook +spec: + selector: + matchLabels: + app: guestbook + tier: frontend + replicas: 3 + template: + metadata: + labels: + app: guestbook + tier: frontend + spec: + containers: + - name: php-redis + image: gcr.io/google-samples/gb-frontend:v4 + resources: + requests: + cpu: 100m + memory: 100Mi + env: + - name: GET_HOSTS_FROM + value: dns + # Using `GET_HOSTS_FROM=dns` requires your cluster to + # provide a dns service. As of Kubernetes 1.3, DNS is a built-in + # service launched automatically. However, if the cluster you are using + # does not have a built-in DNS service, you can instead + # access an environment variable to find the master + # service's host. To do so, comment out the 'value: dns' line above, and + # uncomment the line below: + # value: env + ports: + - containerPort: 80 diff --git a/content/zh/examples/application/guestbook/frontend-service.yaml b/content/zh/examples/application/guestbook/frontend-service.yaml new file mode 100644 index 0000000000..6f283f347b --- /dev/null +++ b/content/zh/examples/application/guestbook/frontend-service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: frontend + labels: + app: guestbook + tier: frontend +spec: + # comment or delete the following line if you want to use a LoadBalancer + type: NodePort + # if your cluster supports it, uncomment the following to automatically create + # an external load-balanced IP for the frontend service. + # type: LoadBalancer + ports: + - port: 80 + selector: + app: guestbook + tier: frontend diff --git a/content/zh/examples/application/guestbook/redis-master-deployment.yaml b/content/zh/examples/application/guestbook/redis-master-deployment.yaml new file mode 100644 index 0000000000..fc6f418c39 --- /dev/null +++ b/content/zh/examples/application/guestbook/redis-master-deployment.yaml @@ -0,0 +1,29 @@ +apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 +kind: Deployment +metadata: + name: redis-master + labels: + app: redis +spec: + selector: + matchLabels: + app: redis + role: master + tier: backend + replicas: 1 + template: + metadata: + labels: + app: redis + role: master + tier: backend + spec: + containers: + - name: master + image: k8s.gcr.io/redis:e2e # or just image: redis + resources: + requests: + cpu: 100m + memory: 100Mi + ports: + - containerPort: 6379 diff --git a/content/zh/examples/application/guestbook/redis-master-service.yaml b/content/zh/examples/application/guestbook/redis-master-service.yaml new file mode 100644 index 0000000000..a484014f1f --- /dev/null +++ b/content/zh/examples/application/guestbook/redis-master-service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: redis-master + labels: + app: redis + role: master + tier: backend +spec: + ports: + - port: 6379 + targetPort: 6379 + selector: + app: redis + role: master + tier: backend diff --git a/content/zh/examples/application/guestbook/redis-slave-deployment.yaml b/content/zh/examples/application/guestbook/redis-slave-deployment.yaml new file mode 100644 index 0000000000..ec4e48bc21 --- /dev/null +++ b/content/zh/examples/application/guestbook/redis-slave-deployment.yaml @@ -0,0 +1,40 @@ +apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 +kind: Deployment +metadata: + name: redis-slave + labels: + app: redis +spec: + selector: + matchLabels: + app: redis + role: slave + tier: backend + replicas: 2 + template: + metadata: + labels: + app: redis + role: slave + tier: backend + spec: + containers: + - name: slave + image: gcr.io/google_samples/gb-redisslave:v1 + resources: + requests: + cpu: 100m + memory: 100Mi + env: + - name: GET_HOSTS_FROM + value: dns + # Using `GET_HOSTS_FROM=dns` requires your cluster to + # provide a dns service. As of Kubernetes 1.3, DNS is a built-in + # service launched automatically. However, if the cluster you are using + # does not have a built-in DNS service, you can instead + # access an environment variable to find the master + # service's host. To do so, comment out the 'value: dns' line above, and + # uncomment the line below: + # value: env + ports: + - containerPort: 6379 diff --git a/content/zh/examples/application/guestbook/redis-slave-service.yaml b/content/zh/examples/application/guestbook/redis-slave-service.yaml new file mode 100644 index 0000000000..238fd63fb6 --- /dev/null +++ b/content/zh/examples/application/guestbook/redis-slave-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: redis-slave + labels: + app: redis + role: slave + tier: backend +spec: + ports: + - port: 6379 + selector: + app: redis + role: slave + tier: backend diff --git a/content/zh/examples/application/hpa/php-apache.yaml b/content/zh/examples/application/hpa/php-apache.yaml new file mode 100644 index 0000000000..c73ae7d631 --- /dev/null +++ b/content/zh/examples/application/hpa/php-apache.yaml @@ -0,0 +1,13 @@ +apiVersion: autoscaling/v1 +kind: HorizontalPodAutoscaler +metadata: + name: php-apache + namespace: default +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: php-apache + minReplicas: 1 + maxReplicas: 10 + targetCPUUtilizationPercentage: 50 diff --git a/content/zh/examples/application/job/cronjob.yaml b/content/zh/examples/application/job/cronjob.yaml new file mode 100644 index 0000000000..c9d3893027 --- /dev/null +++ b/content/zh/examples/application/job/cronjob.yaml @@ -0,0 +1,18 @@ +apiVersion: batch/v1beta1 +kind: CronJob +metadata: + name: hello +spec: + schedule: "*/1 * * * *" + jobTemplate: + spec: + template: + spec: + containers: + - name: hello + image: busybox + args: + - /bin/sh + - -c + - date; echo Hello from the Kubernetes cluster + restartPolicy: OnFailure diff --git a/content/zh/examples/application/job/job-tmpl.yaml b/content/zh/examples/application/job/job-tmpl.yaml new file mode 100644 index 0000000000..790025b38b --- /dev/null +++ b/content/zh/examples/application/job/job-tmpl.yaml @@ -0,0 +1,18 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: process-item-$ITEM + labels: + jobgroup: jobexample +spec: + template: + metadata: + name: jobexample + labels: + jobgroup: jobexample + spec: + containers: + - name: c + image: busybox + command: ["sh", "-c", "echo Processing item $ITEM && sleep 5"] + restartPolicy: Never diff --git a/content/zh/examples/application/job/redis/Dockerfile b/content/zh/examples/application/job/redis/Dockerfile new file mode 100644 index 0000000000..2de23b3c98 --- /dev/null +++ b/content/zh/examples/application/job/redis/Dockerfile @@ -0,0 +1,6 @@ +FROM python +RUN pip install redis +COPY ./worker.py /worker.py +COPY ./rediswq.py /rediswq.py + +CMD python worker.py diff --git a/content/zh/examples/application/job/redis/redis-pod.yaml b/content/zh/examples/application/job/redis/redis-pod.yaml new file mode 100644 index 0000000000..ae0c43a793 --- /dev/null +++ b/content/zh/examples/application/job/redis/redis-pod.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: redis-master + labels: + app: redis +spec: + containers: + - name: master + image: redis + env: + - name: MASTER + value: "true" + ports: + - containerPort: 6379 diff --git a/content/zh/examples/application/job/redis/redis-service.yaml b/content/zh/examples/application/job/redis/redis-service.yaml new file mode 100644 index 0000000000..85f2ca2271 --- /dev/null +++ b/content/zh/examples/application/job/redis/redis-service.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Service +metadata: + name: redis +spec: + ports: + - port: 6379 + targetPort: 6379 + selector: + app: redis diff --git a/content/zh/examples/application/job/redis/rediswq.py b/content/zh/examples/application/job/redis/rediswq.py new file mode 100644 index 0000000000..ceda8bd1e3 --- /dev/null +++ b/content/zh/examples/application/job/redis/rediswq.py @@ -0,0 +1,130 @@ +#!/usr/bin/env python + +# Based on http://peter-hoffmann.com/2012/python-simple-queue-redis-queue.html +# and the suggestion in the redis documentation for RPOPLPUSH, at +# http://redis.io/commands/rpoplpush, which suggests how to implement a work-queue. + + +import redis +import uuid +import hashlib + +class RedisWQ(object): + """Simple Finite Work Queue with Redis Backend + + This work queue is finite: as long as no more work is added + after workers start, the workers can detect when the queue + is completely empty. + + The items in the work queue are assumed to have unique values. + + This object is not intended to be used by multiple threads + concurrently. + """ + def __init__(self, name, **redis_kwargs): + """The default connection parameters are: host='localhost', port=6379, db=0 + + The work queue is identified by "name". The library may create other + keys with "name" as a prefix. + """ + self._db = redis.StrictRedis(**redis_kwargs) + # The session ID will uniquely identify this "worker". + self._session = str(uuid.uuid4()) + # Work queue is implemented as two queues: main, and processing. + # Work is initially in main, and moved to processing when a client picks it up. + self._main_q_key = name + self._processing_q_key = name + ":processing" + self._lease_key_prefix = name + ":leased_by_session:" + + def sessionID(self): + """Return the ID for this session.""" + return self._session + + def _main_qsize(self): + """Return the size of the main queue.""" + return self._db.llen(self._main_q_key) + + def _processing_qsize(self): + """Return the size of the main queue.""" + return self._db.llen(self._processing_q_key) + + def empty(self): + """Return True if the queue is empty, including work being done, False otherwise. + + False does not necessarily mean that there is work available to work on right now, + """ + return self._main_qsize() == 0 and self._processing_qsize() == 0 + +# TODO: implement this +# def check_expired_leases(self): +# """Return to the work queueReturn True if the queue is empty, False otherwise.""" +# # Processing list should not be _too_ long since it is approximately as long +# # as the number of active and recently active workers. +# processing = self._db.lrange(self._processing_q_key, 0, -1) +# for item in processing: +# # If the lease key is not present for an item (it expired or was +# # never created because the client crashed before creating it) +# # then move the item back to the main queue so others can work on it. +# if not self._lease_exists(item): +# TODO: transactionally move the key from processing queue to +# to main queue, while detecting if a new lease is created +# or if either queue is modified. + + def _itemkey(self, item): + """Returns a string that uniquely identifies an item (bytes).""" + return hashlib.sha224(item).hexdigest() + + def _lease_exists(self, item): + """True if a lease on 'item' exists.""" + return self._db.exists(self._lease_key_prefix + self._itemkey(item)) + + def lease(self, lease_secs=60, block=True, timeout=None): + """Begin working on an item the work queue. + + Lease the item for lease_secs. After that time, other + workers may consider this client to have crashed or stalled + and pick up the item instead. + + If optional args block is true and timeout is None (the default), block + if necessary until an item is available.""" + if block: + item = self._db.brpoplpush(self._main_q_key, self._processing_q_key, timeout=timeout) + else: + item = self._db.rpoplpush(self._main_q_key, self._processing_q_key) + if item: + # Record that we (this session id) are working on a key. Expire that + # note after the lease timeout. + # Note: if we crash at this line of the program, then GC will see no lease + # for this item a later return it to the main queue. + itemkey = self._itemkey(item) + self._db.setex(self._lease_key_prefix + itemkey, lease_secs, self._session) + return item + + def complete(self, value): + """Complete working on the item with 'value'. + + If the lease expired, the item may not have completed, and some + other worker may have picked it up. There is no indication + of what happened. + """ + self._db.lrem(self._processing_q_key, 0, value) + # If we crash here, then the GC code will try to move the value, but it will + # not be here, which is fine. So this does not need to be a transaction. + itemkey = self._itemkey(value) + self._db.delete(self._lease_key_prefix + itemkey, self._session) + +# TODO: add functions to clean up all keys associated with "name" when +# processing is complete. + +# TODO: add a function to add an item to the queue. Atomically +# check if the queue is empty and if so fail to add the item +# since other workers might think work is done and be in the process +# of exiting. + +# TODO(etune): move to my own github for hosting, e.g. github.com/erictune/rediswq-py and +# make it so it can be pip installed by anyone (see +# http://stackoverflow.com/questions/8247605/configuring-so-that-pip-install-can-work-from-github) + +# TODO(etune): finish code to GC expired leases, and call periodically +# e.g. each time lease times out. + diff --git a/content/zh/examples/application/mysql/mysql-configmap.yaml b/content/zh/examples/application/mysql/mysql-configmap.yaml new file mode 100644 index 0000000000..46d34e422c --- /dev/null +++ b/content/zh/examples/application/mysql/mysql-configmap.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: mysql + labels: + app: mysql +data: + master.cnf: | + # Apply this config only on the master. + [mysqld] + log-bin + slave.cnf: | + # Apply this config only on slaves. + [mysqld] + super-read-only + diff --git a/content/zh/examples/application/mysql/mysql-deployment.yaml b/content/zh/examples/application/mysql/mysql-deployment.yaml new file mode 100644 index 0000000000..518457777e --- /dev/null +++ b/content/zh/examples/application/mysql/mysql-deployment.yaml @@ -0,0 +1,43 @@ +apiVersion: v1 +kind: Service +metadata: + name: mysql +spec: + ports: + - port: 3306 + selector: + app: mysql + clusterIP: None +--- +apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 +kind: Deployment +metadata: + name: mysql +spec: + selector: + matchLabels: + app: mysql + strategy: + type: Recreate + template: + metadata: + labels: + app: mysql + spec: + containers: + - image: mysql:5.6 + name: mysql + env: + # Use secret in real usage + - name: MYSQL_ROOT_PASSWORD + value: password + ports: + - containerPort: 3306 + name: mysql + volumeMounts: + - name: mysql-persistent-storage + mountPath: /var/lib/mysql + volumes: + - name: mysql-persistent-storage + persistentVolumeClaim: + claimName: mysql-pv-claim diff --git a/content/zh/examples/application/mysql/mysql-pv.yaml b/content/zh/examples/application/mysql/mysql-pv.yaml new file mode 100644 index 0000000000..6f4e692f3b --- /dev/null +++ b/content/zh/examples/application/mysql/mysql-pv.yaml @@ -0,0 +1,26 @@ +kind: PersistentVolume +apiVersion: v1 +metadata: + name: mysql-pv-volume + labels: + type: local +spec: + storageClassName: manual + capacity: + storage: 20Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/data" +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: mysql-pv-claim +spec: + storageClassName: manual + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 20Gi diff --git a/content/zh/examples/application/mysql/mysql-services.yaml b/content/zh/examples/application/mysql/mysql-services.yaml new file mode 100644 index 0000000000..f538992566 --- /dev/null +++ b/content/zh/examples/application/mysql/mysql-services.yaml @@ -0,0 +1,30 @@ +# Headless service for stable DNS entries of StatefulSet members. +apiVersion: v1 +kind: Service +metadata: + name: mysql + labels: + app: mysql +spec: + ports: + - name: mysql + port: 3306 + clusterIP: None + selector: + app: mysql +--- +# Client service for connecting to any MySQL instance for reads. +# For writes, you must instead connect to the master: mysql-0.mysql. +apiVersion: v1 +kind: Service +metadata: + name: mysql-read + labels: + app: mysql +spec: + ports: + - name: mysql + port: 3306 + selector: + app: mysql + diff --git a/content/zh/examples/application/mysql/mysql-statefulset.yaml b/content/zh/examples/application/mysql/mysql-statefulset.yaml new file mode 100644 index 0000000000..e0c04007a8 --- /dev/null +++ b/content/zh/examples/application/mysql/mysql-statefulset.yaml @@ -0,0 +1,167 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: mysql +spec: + selector: + matchLabels: + app: mysql + serviceName: mysql + replicas: 3 + template: + metadata: + labels: + app: mysql + spec: + initContainers: + - name: init-mysql + image: mysql:5.7 + command: + - bash + - "-c" + - | + set -ex + # Generate mysql server-id from pod ordinal index. + [[ `hostname` =~ -([0-9]+)$ ]] || exit 1 + ordinal=${BASH_REMATCH[1]} + echo [mysqld] > /mnt/conf.d/server-id.cnf + # Add an offset to avoid reserved server-id=0 value. + echo server-id=$((100 + $ordinal)) >> /mnt/conf.d/server-id.cnf + # Copy appropriate conf.d files from config-map to emptyDir. + if [[ $ordinal -eq 0 ]]; then + cp /mnt/config-map/master.cnf /mnt/conf.d/ + else + cp /mnt/config-map/slave.cnf /mnt/conf.d/ + fi + volumeMounts: + - name: conf + mountPath: /mnt/conf.d + - name: config-map + mountPath: /mnt/config-map + - name: clone-mysql + image: gcr.io/google-samples/xtrabackup:1.0 + command: + - bash + - "-c" + - | + set -ex + # Skip the clone if data already exists. + [[ -d /var/lib/mysql/mysql ]] && exit 0 + # Skip the clone on master (ordinal index 0). + [[ `hostname` =~ -([0-9]+)$ ]] || exit 1 + ordinal=${BASH_REMATCH[1]} + [[ $ordinal -eq 0 ]] && exit 0 + # Clone data from previous peer. + ncat --recv-only mysql-$(($ordinal-1)).mysql 3307 | xbstream -x -C /var/lib/mysql + # Prepare the backup. + xtrabackup --prepare --target-dir=/var/lib/mysql + volumeMounts: + - name: data + mountPath: /var/lib/mysql + subPath: mysql + - name: conf + mountPath: /etc/mysql/conf.d + containers: + - name: mysql + image: mysql:5.7 + env: + - name: MYSQL_ALLOW_EMPTY_PASSWORD + value: "1" + ports: + - name: mysql + containerPort: 3306 + volumeMounts: + - name: data + mountPath: /var/lib/mysql + subPath: mysql + - name: conf + mountPath: /etc/mysql/conf.d + resources: + requests: + cpu: 500m + memory: 1Gi + livenessProbe: + exec: + command: ["mysqladmin", "ping"] + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + readinessProbe: + exec: + # Check we can execute queries over TCP (skip-networking is off). + command: ["mysql", "-h", "127.0.0.1", "-e", "SELECT 1"] + initialDelaySeconds: 5 + periodSeconds: 2 + timeoutSeconds: 1 + - name: xtrabackup + image: gcr.io/google-samples/xtrabackup:1.0 + ports: + - name: xtrabackup + containerPort: 3307 + command: + - bash + - "-c" + - | + set -ex + cd /var/lib/mysql + + # Determine binlog position of cloned data, if any. + if [[ -f xtrabackup_slave_info ]]; then + # XtraBackup already generated a partial "CHANGE MASTER TO" query + # because we're cloning from an existing slave. + mv xtrabackup_slave_info change_master_to.sql.in + # Ignore xtrabackup_binlog_info in this case (it's useless). + rm -f xtrabackup_binlog_info + elif [[ -f xtrabackup_binlog_info ]]; then + # We're cloning directly from master. Parse binlog position. + [[ `cat xtrabackup_binlog_info` =~ ^(.*?)[[:space:]]+(.*?)$ ]] || exit 1 + rm xtrabackup_binlog_info + echo "CHANGE MASTER TO MASTER_LOG_FILE='${BASH_REMATCH[1]}',\ + MASTER_LOG_POS=${BASH_REMATCH[2]}" > change_master_to.sql.in + fi + + # Check if we need to complete a clone by starting replication. + if [[ -f change_master_to.sql.in ]]; then + echo "Waiting for mysqld to be ready (accepting connections)" + until mysql -h 127.0.0.1 -e "SELECT 1"; do sleep 1; done + + echo "Initializing replication from clone position" + # In case of container restart, attempt this at-most-once. + mv change_master_to.sql.in change_master_to.sql.orig + mysql -h 127.0.0.1 <