Merge branch 'master' into release-1.9

This commit is contained in:
zacharysarah
2017-11-27 12:44:07 -06:00
50 changed files with 483 additions and 255 deletions
+66 -3
View File
@@ -432,7 +432,7 @@
name: 'Kublr', name: 'Kublr',
logo: 'kublr', logo: 'kublr',
link: 'http://kublr.com', link: 'http://kublr.com',
blurb: 'SSimplify and speed up the management of your containerized applications at scale.' blurb: 'Simplify and speed up the management of your containerized applications at scale.'
}, },
{ {
type: 0, type: 0,
@@ -614,7 +614,7 @@
name: 'Sphere Software, LLC', name: 'Sphere Software, LLC',
logo: 'spheresoftware', logo: 'spheresoftware',
link: 'https://sphereinc.com/kubernetes/', link: 'https://sphereinc.com/kubernetes/',
blurb: 'Architect and implement scalable applications using Kubernetes in Google Cloud, AWS, and Azure with our team of experts.' blurb: 'The Sphere Software team of experts allows customers to architect and implement scalable applications using Kubernetes in Google Cloud, AWS, and Azure.'
}, },
{ {
type: 1, type: 1,
@@ -742,6 +742,13 @@
link: 'https://caicloud.io/products/compass', link: 'https://caicloud.io/products/compass',
blurb: 'Caicloud - Compass' blurb: 'Caicloud - Compass'
}, },
{
type: 2,
name: 'Caicloud',
logo: 'caicloud',
link: 'https://caicloud.io/',
blurb: 'Founded by ex-Googlers,and early Kubernetes contributors, Caicloud leverages Kubernetes to provide container products which have successfully served Fortune 500 enterprises, and further utilizes Kubernetes as a vehicle to deliver ultra-speed deep learning experience.'
},
{ {
type: 3, type: 3,
name: 'Alibaba', name: 'Alibaba',
@@ -788,7 +795,7 @@
type: 3, type: 3,
name: 'Loodse', name: 'Loodse',
logo: 'loodse', logo: 'loodse',
link: 'https://loodse.io', link: 'https://loodse.com',
blurb: 'Loodse - Kubermatic Container Engine' blurb: 'Loodse - Kubermatic Container Engine'
}, },
{ {
@@ -798,6 +805,13 @@
link: 'https://github.com/Azure/acs-engine', link: 'https://github.com/Azure/acs-engine',
blurb: 'Microsoft - Azure acs-engine' blurb: 'Microsoft - Azure acs-engine'
}, },
{
type: 3,
name: 'Microsoft',
logo: 'microsoft',
link: 'https://docs.microsoft.com/en-us/azure/aks/',
blurb: 'Microsoft - Azure Container Service AKS'
},
{ {
type: 3, type: 3,
name: 'Oracle', name: 'Oracle',
@@ -910,6 +924,20 @@
link: 'https://gopaddle.io', link: 'https://gopaddle.io',
blurb: 'goPaddle is a DevOps platform for Kubernetes developers. It simplifies the Kubernetes Service creation and maintenance through source to image conversion, build & version management, team management, access controls and audit logs, single click provision of Kubernetes Clusters across multiple clouds from a single console.' blurb: 'goPaddle is a DevOps platform for Kubernetes developers. It simplifies the Kubernetes Service creation and maintenance through source to image conversion, build & version management, team management, access controls and audit logs, single click provision of Kubernetes Clusters across multiple clouds from a single console.'
}, },
{
type: 0,
name: 'Vexxhost',
logo: 'vexxhost',
link: 'https://vexxhost.com/public-cloud/container-services/kubernetes/',
blurb: 'VEXXHOST offers a high-performance container management service powered by Kubernetes and OpenStack Magnum.'
},
{
type: 1,
name: 'Component Soft',
logo: 'componentsoft',
link: 'https://www.componentsoft.eu/?p=3925',
blurb: 'Component Soft offers training, consultation and support around open cloud technologies like Kubernetes, Docker, Openstack and Ceph.'
},
{ {
type: 0, type: 0,
name: 'Datera', name: 'Datera',
@@ -945,6 +973,41 @@
link: 'https://docs.portworx.com/scheduler/kubernetes/install.html', link: 'https://docs.portworx.com/scheduler/kubernetes/install.html',
blurb: 'With Portworx, you can manage any database or stateful service on any infrastructure using Kubernetes. You get a single data management layer for all of your stateful services, no matter where they run.' blurb: 'With Portworx, you can manage any database or stateful service on any infrastructure using Kubernetes. You get a single data management layer for all of your stateful services, no matter where they run.'
}, },
{
type: 1,
name: 'Object Computing, Inc.',
logo: 'objectcomputing',
link: 'https://objectcomputing.com/services/software-engineering/devops/kubernetes-services',
blurb: 'Our portfolio of DevOps consulting services includes Kubernetes support, development, and training.'
},
{
type: 1,
name: 'Isotoma',
logo: 'isotoma',
link: 'https://www.isotoma.com/blog/2017/10/24/containerisation-tips-for-using-kubernetes-with-aws/',
blurb: 'Based in the North of England, Amazon partners who are delivering Kubernetes solutions on AWS for replatforming and native development.'
},
{
type: 1,
name: 'Servian',
logo: 'servian',
link: 'https://www.servian.com/cloud-and-technology/',
blurb: 'Based in Australia, Servian provides advisory, consulting and managed services to support both application and data centric kubernetes use cases.'
},
{
type: 1,
name: 'Redzara',
logo: 'redzara',
link: 'http://redzara.com/cloud-service',
blurb: 'Redzara has wide and in-depth experience in Cloud automation, now taking one giant step by providing container service offering and services to our customers.'
},
{
type: 0,
name: 'Dataspine',
logo: 'dataspine',
link: 'http://dataspine.xyz/',
blurb: 'Dataspine is building a secure, elastic and serverless deployment platform for production ML/AI workloads on top of k8s.'
},
{ {
type: 0, type: 0,
name: 'Logdna', name: 'Logdna',
@@ -45,7 +45,7 @@ Kubernetes 垃圾收集器的角色是删除指定的对象,这些对象曾经
如果创建该 ReplicaSet,然后查看 Pod 的 metadata 字段,能够看到 OwnerReferences 字段: 如果创建该 ReplicaSet,然后查看 Pod 的 metadata 字段,能够看到 OwnerReferences 字段:
```shell ```shell
kubectl create -f https://k8s.io/docs/concepts/abstractions/controllers/my-repset.yaml kubectl create -f https://k8s.io/docs/concepts/controllers/my-repset.yaml
kubectl get pods --output=yaml kubectl get pods --output=yaml
``` ```
@@ -0,0 +1,104 @@
---
title: 知名标签(Label)、注解(Annotation)和 Taints
---
Kubernetes 保留了 kubernetes.io 名字空间下的所有标签和注解。 本文描述了知名的
kubernetes.io 标签和注解。
本文既作为这些标签和注解值的参考,也就这些标签和注解的赋值进行了说明。
**目录:**
<!-- BEGIN MUNGE: GENERATED_TOC -->
- [知名标签、注解和 Taints](#well-known-labels-annotations-and-taints)
- [beta.kubernetes.io/arch](#betakubernetesioarch)
- [beta.kubernetes.io/os](#betakubernetesioos)
- [kubernetes.io/hostname](#kubernetesiohostname)
- [beta.kubernetes.io/instance-type](#betakubernetesioinstance-type)
- [failure-domain.beta.kubernetes.io/region](#failure-domainbetakubernetesioregion)
- [failure-domain.beta.kubernetes.io/zone](#failure-domainbetakubernetesiozone)
<!-- END MUNGE: GENERATED_TOC -->
## beta.kubernetes.io/arch
示例:`beta.kubernetes.io/arch=amd64`
用于:节点
Kubelet 用 Go 中定义的 `runtime.GOARCH` 值来填充该标签。 这在诸如混用 arm 和 x86 节点的情况下很有用。
## beta.kubernetes.io/os
示例:`beta.kubernetes.io/os=linux`
用于:节点
Kubelet 用该 Go 中定义的 `runtime.GOOS` 值来填充该标签。 这在集群中存在不同操作系统的节点时很有用(尽管当前 Kubernetes 只支持 Linux 操作系统)。
## kubernetes.io/hostname
示例:`kubernetes.io/hostname=ip-172-20-114-199.ec2.internal`
用于:节点
Kubelet 用 hostname 值来填充该标签。 注意:可以通过向 kubelet 传入 `--hostname-override`
参数对 “真正的” hostname 进行修改。
## beta.kubernetes.io/instance-type
示例:`beta.kubernetes.io/instance-type=m3.medium`
用于:节点
Kubelet 用 `cloudprovider` 中定义的实例类型来填充该标签。 未使用 `cloudprovider` 时不会设置该标签。
该标签在想要将某些负载定向到特定实例类型的节点上时会很有用,但通常用户更希望依赖 Kubernetes 调度器来执行基于资源的调度,所以用户应该致力于基于属性而不是实例类型来进行调度(例如:需要一个 CPU,而不是 `g2.2xlarge`)。
## failure-domain.beta.kubernetes.io/region
参考 [failure-domain.beta.kubernetes.io/zone](#failure-domainbetakubernetesiozone).
## failure-domain.beta.kubernetes.io/zone
示例:
`failure-domain.beta.kubernetes.io/region=us-east-1`
`failure-domain.beta.kubernetes.io/zone=us-east-1c`
用于:节点、PersistentVolume
用于节点: Kubelet 用 `cloudprovider` 中定义的区域(zone)信息来填充该标签。 未使用 `cloudprovider`
时不会设置该标签,但如果该标签在你的拓扑中有意义的话,应该考虑设置。
用于 PersistentVolume:在 GCE 和 AWS 中,`PersistentVolumeLabel` 准入控制器会自动添加区域标签。
在单区的集群中,Kubernetes 会自动将同一副本控制器或服务下的 pod 分散到不同的节点上 (以降低故障的影响)。
在多区的集群中,这种分散的行为扩展到跨区的层面 (以降低区域故障的影响)。 跨区分散通过 SelectorSpreadPriority
来实现。
这是一种尽力而为(best-effort)的处置方式, 如果集群中的区域是异构的 (例如:不同区域之间的节点数量、
节点类型或 pod 资源需求不同),可能使得 pod 在各区域间无法均匀分布。 如有需要,用户可以使用同质的区域
(节点数量和类型相同) 来减小 pod 分布不均的可能性。
由于卷不能跨区域挂载(attach),调度器 (通过 VolumeZonePredicate 断言) 也会保证需要特定卷的 pod
被调度到卷所在的区域中。
区域和地域(region)的实际值无关紧要,两者的层次含义也没有严格的定义。 最终期望是,除非整个地域故障,
否则某一区域节点的故障不应该影响到其他区域的节点。 例如,通常区域间应该避免共用同一个网络交换机。
具体的规划取决于特定的基础设备—— three-rack 设备所选择的设置与多数据中心截然不同。
如果 `PersistentVolumeLabel` 准入控制器不支持自动为 PersistentVolume 打标签,且用户希望防止 pod
跨区域进行卷的挂载,应考虑手动打标签 (或对 `PersistentVolumeLabel` 增加支持)。 如果用户的基础设施没有这种约束,则不需要为卷添加区域标签。
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![分析](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/api-reference/labels-annotations-taints.md?pixel)]()
<!-- END MUNGE: GENERATED_ANALYTICS -->
+1 -1
View File
@@ -7,7 +7,7 @@ cid: community
<section id="hero" class="light-text"> <section id="hero" class="light-text">
<h1>Community</h1> <h1>Community</h1>
</section> </section>
<a href="https://goo.gl/nhbhXw"><img src="/images/KubeCon_NA_Community.png" alt="KubeConNA" width="100%" align="center"></a> <a href="https://goo.gl/QsHxQH"><img src="/images/KubeCon_NA_Community.jpg" alt="KubeConNA" width="100%" align="center"></a>
<section id="mainContent"> <section id="mainContent">
<main> <main>
<div class="content"> <div class="content">
+4 -2
View File
@@ -31,8 +31,10 @@ A configuration example which uses HTTPS client auth:
clusters: clusters:
- name: name-of-remote-authz-service - name: name-of-remote-authz-service
cluster: cluster:
certificate-authority: /path/to/ca.pem # CA for verifying the remote service. # CA for verifying the remote service.
server: https://authz.example.com/authorize # URL of remote service to query. Must use 'https'. certificate-authority: /path/to/ca.pem
# URL of remote service to query. Must use 'https'. May not include parameters.
server: https://authz.example.com/authorize
# users refers to the API Server's webhook configuration. # users refers to the API Server's webhook configuration.
users: users:
-18
View File
@@ -1,18 +0,0 @@
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: prometheus-node-exporter
spec:
template:
metadata:
name: prometheus-node-exporter
labels:
daemon: prom-node-exp
spec:
containers:
- name: c
image: prom/prometheus
ports:
- containerPort: 9090
hostPort: 9090
name: serverport
@@ -21,9 +21,6 @@ spec:
volumeMounts: volumeMounts:
- mountPath: /var/log/kube-scheduler.log - mountPath: /var/log/kube-scheduler.log
name: logfile name: logfile
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: default-token-s8ejd
readOnly: true
volumes: volumes:
- hostPath: - hostPath:
path: /var/log/kube-scheduler.log path: /var/log/kube-scheduler.log
+1 -1
View File
@@ -7,4 +7,4 @@ metadata:
spec: spec:
containers: containers:
- name: pod-with-no-annotation-container - name: pod-with-no-annotation-container
image: gcr.io/google_containers/pause:2.0 image: gcr.io/google_containers/pause:2.0
@@ -1,17 +0,0 @@
apiVersion: extensions/v1beta1
kind: ReplicaSet
metadata:
name: my-repset
spec:
replicas: 3
selector:
matchLabels:
pod-is-for: garbage-collection-example
template:
metadata:
labels:
pod-is-for: garbage-collection-example
spec:
containers:
- name: nginx
image: nginx
@@ -213,6 +213,28 @@ provider configuration:
bs-version=v2 bs-version=v2
``` ```
#### Metadata
These configuration options for the OpenStack provider pertain to metadata and
should appear in the `[Metadata]` section of the `cloud.conf` file:
* `search-order` (Optional): This configuration key influences the way that the
provider retrieves metadata relating to the instance(s) in which it runs. The
default value of `configDrive,metadataService` results in the provider
retrieving metadata relating to the instance from the config drive first if
available and then the metadata service. Alternative values are:
* `configDrive` - Only retrieve instance metadata from the configuration
drive.
* `metadataService` - Only retrieve instance metadata from the metadata
service.
* `metadataService,configDrive` - Retrieve instance metadata from the metadata
service first if available, then the configuration drive.
Influencing this behavior may be desirable as the metadata on the
configuration drive may grow stale over time, whereas the metadata service
always provides the most up to date view. Not all OpenStack clouds provide
both configuration drive and metadata service though and only one or the other
may be available which is why the default is to check both.
#### Router #### Router
These configuration options for the OpenStack provider pertain to routing and These configuration options for the OpenStack provider pertain to routing and
should appear in the `[Route]` section of the `cloud.conf` file: should appear in the `[Route]` section of the `cloud.conf` file:
+1 -7
View File
@@ -37,13 +37,7 @@ This is a living document. If you think of something that is not on this list bu
## Services ## Services
- It's typically best to create a [service](/docs/concepts/services-networking/service/) before corresponding [replication controllers](/docs/concepts/workloads/controllers/replicationcontroller/). This lets the scheduler spread the pods that comprise the service. - It's typically best to create a [service](/docs/concepts/services-networking/service/) before the corresponding [replication controllers](/docs/concepts/workloads/controllers/replicationcontroller/). This lets the scheduler spread the pods that comprise the service.
You can also use this process to ensure that at least one replica works before creating lots of them:
1. Create a replication controller without specifying replicas (this will set replicas=1);
2. Create a service;
3. Then scale up the replication controller.
- Don't use `hostPort` unless it is absolutely necessary (for example: for a node daemon). It specifies the port number to expose on the host. When you bind a Pod to a `hostPort`, there are a limited number of places to schedule a pod due to port conflicts— you can only schedule as many such Pods as there are nodes in your Kubernetes cluster. - Don't use `hostPort` unless it is absolutely necessary (for example: for a node daemon). It specifies the port number to expose on the host. When you bind a Pod to a `hostPort`, there are a limited number of places to schedule a pod due to port conflicts— you can only schedule as many such Pods as there are nodes in your Kubernetes cluster.
@@ -39,8 +39,7 @@ The following sections provide more information about these steps.
## Enabling priority and preemption ## Enabling priority and preemption
Pod priority and preemption is disabled by default in Kubernetes 1.8. Pod priority and preemption is disabled by default in Kubernetes 1.8.
To enable the feature, set this command-line flag for the API server To enable the feature, set this command-line flag for the API server, scheduler and kubelet:
and the scheduler:
``` ```
--feature-gates=PodPriority=true --feature-gates=PodPriority=true
@@ -4,6 +4,9 @@ metadata:
name: nginx-deployment name: nginx-deployment
spec: spec:
replicas: 3 replicas: 3
selector:
matchLabels:
app: nginx
template: template:
metadata: metadata:
labels: labels:
+25 -31
View File
@@ -117,7 +117,7 @@ subsets:
- port: 9376 - port: 9376
``` ```
NOTE: Endpoint IPs may not be loopback (127.0.0.0/8), link-local **NOTE:** Endpoint IPs may not be loopback (127.0.0.0/8), link-local
(169.254.0.0/16), or link-local multicast (224.0.0.0/24). (169.254.0.0/16), or link-local multicast (224.0.0.0/24).
Accessing a `Service` without a selector works the same as if it had a selector. Accessing a `Service` without a selector works the same as if it had a selector.
@@ -151,13 +151,11 @@ its pods, add appropriate selectors or endpoints and change the service `type`.
Every node in a Kubernetes cluster runs a `kube-proxy`. `kube-proxy` is Every node in a Kubernetes cluster runs a `kube-proxy`. `kube-proxy` is
responsible for implementing a form of virtual IP for `Services` of type other responsible for implementing a form of virtual IP for `Services` of type other
than `ExternalName`. than `ExternalName`.
In Kubernetes v1.0 the proxy was purely in userspace. In Kubernetes v1.1 an In Kubernetes v1.0, `Services` are a "layer 4" (TCP/UDP over IP) construct, the
iptables proxy was added, but was not the default operating mode. Since proxy was purely in userspace. In Kubernetes v1.1, the `Ingress` API was added
Kubernetes v1.2, the iptables proxy is the default. (beta) to represent "layer 7"(HTTP) services, iptables proxy was added too,
and become the default operating mode since Kubernetes v1.2. In Kubernetes v1.9-alpha,
As of Kubernetes v1.0, `Services` are a "layer 4" (TCP/UDP over IP) construct. ipvs proxy was added.
In Kubernetes v1.1 the `Ingress` API was added (beta) to represent "layer 7"
(HTTP) services.
### Proxy-mode: userspace ### Proxy-mode: userspace
@@ -169,37 +167,20 @@ will be proxied to one of the `Service`'s backend `Pods` (as reported in
`SessionAffinity` of the `Service`. Lastly, it installs iptables rules which `SessionAffinity` of the `Service`. Lastly, it installs iptables rules which
capture traffic to the `Service`'s `clusterIP` (which is virtual) and `Port` capture traffic to the `Service`'s `clusterIP` (which is virtual) and `Port`
and redirects that traffic to the proxy port which proxies the backend `Pod`. and redirects that traffic to the proxy port which proxies the backend `Pod`.
By default, the choice of backend is round robin.
The net result is that any traffic bound for the `Service`'s IP:Port is proxied
to an appropriate backend without the clients knowing anything about Kubernetes
or `Services` or `Pods`.
By default, the choice of backend is round robin. Client-IP based session affinity
can be selected by setting `service.spec.sessionAffinity` to `"ClientIP"` (the
default is `"None"`), and you can set the max session sticky time by setting the field
`service.spec.sessionAffinityConfig.clientIP.timeoutSeconds` if you have already set
`service.spec.sessionAffinity` to `"ClientIP"` (the default is "10800").
![Services overview diagram for userspace proxy](/images/docs/services-userspace-overview.svg) ![Services overview diagram for userspace proxy](/images/docs/services-userspace-overview.svg)
### Proxy-mode: iptables ### Proxy-mode: iptables
In this mode, kube-proxy watches the Kubernetes master for the addition and In this mode, kube-proxy watches the Kubernetes master for the addition and
removal of `Service` and `Endpoints` objects. For each `Service` it installs removal of `Service` and `Endpoints` objects. For each `Service`, it installs
iptables rules which capture traffic to the `Service`'s `clusterIP` (which is iptables rules which capture traffic to the `Service`'s `clusterIP` (which is
virtual) and `Port` and redirects that traffic to one of the `Service`'s virtual) and `Port` and redirects that traffic to one of the `Service`'s
backend sets. For each `Endpoints` object it installs iptables rules which backend sets. For each `Endpoints` object, it installs iptables rules which
select a backend `Pod`. select a backend `Pod`.By default, the choice of backend is random.
By default, the choice of backend is random. Client-IP based session affinity Obviously, iptables need not switch back between userspace and kernelspace, it should be
can be selected by setting `service.spec.sessionAffinity` to `"ClientIP"` (the
default is `"None"`), and you can set the max session sticky time by setting the field
`service.spec.sessionAffinityConfig.clientIP.timeoutSeconds` if you have already set
`service.spec.sessionAffinity` to `"ClientIP"` (the default is "10800").
As with the userspace proxy, the net result is that any traffic bound for the
`Service`'s IP:Port is proxied to an appropriate backend without the clients
knowing anything about Kubernetes or `Services` or `Pods`. This should be
faster and more reliable than the userspace proxy. However, unlike the faster and more reliable than the userspace proxy. However, unlike the
userspace proxier, the iptables proxier cannot automatically retry another userspace proxier, the iptables proxier cannot automatically retry another
`Pod` if the one it initially selects does not respond, so it depends on `Pod` if the one it initially selects does not respond, so it depends on
@@ -231,12 +212,21 @@ options for load balancing algorithm, such as:
- nq: never queue - nq: never queue
**Note:** ipvs mode assumed IPVS kernel modules are installed on the node **Note:** ipvs mode assumed IPVS kernel modules are installed on the node
before running kube-proxy. When kube-proxy starts, if proxy mode is ipvs, before running kube-proxy. When kube-proxy starts with ipvs proxy mode,
kube-proxy would validate if IPVS modules are installed on the node, if kube-proxy would validate if IPVS modules are installed on the node, if
it's not installed kube-proxy will fall back to iptables proxy mode. it's not installed kube-proxy will fall back to iptables proxy mode.
![Services overview diagram for ipvs proxy](/images/docs/services-ipvs-overview.svg) ![Services overview diagram for ipvs proxy](/images/docs/services-ipvs-overview.svg)
In any of proxy model, any traffic bound for the Services IP:Port is
proxied to an appropriate backend without the clients knowing anything
about Kubernetes or Services or Pods. Client-IP based session affinity
can be selected by setting service.spec.sessionAffinity to "ClientIP"
(the default is "None"), and you can set the max session sticky time by
setting the field service.spec.sessionAffinityConfig.clientIP.timeoutSeconds
if you have already set service.spec.sessionAffinity to "ClientIP"
(the default is “10800”).
## Multi-Port Services ## Multi-Port Services
Many `Services` need to expose more than one port. For this case, Kubernetes Many `Services` need to expose more than one port. For this case, Kubernetes
@@ -727,6 +717,10 @@ work, and the client IP is not altered.
This same basic flow executes when traffic comes in through a node-port or This same basic flow executes when traffic comes in through a node-port or
through a load-balancer, though in those cases the client IP does get altered. through a load-balancer, though in those cases the client IP does get altered.
#### Ipvs
Iptables operations slow down dramatically in large scale cluster e.g 10,000 Services. IPVS is designed for load balancing and based on in-kernel hash tables. So we can achieve performance consistency in large number of services from IPVS-based kube-proxy. Meanwhile, IPVS-based kube-proxy has more sophisticated load balancing algorithms (least conns, locality, weighted, persistence).
## API Object ## API Object
Service is a top-level resource in the Kubernetes REST API. More details about the Service is a top-level resource in the Kubernetes REST API. More details about the
+1 -4
View File
@@ -54,7 +54,7 @@ dynamic provisioning for themselves.
To enable dynamic storage provisioning based on storage class, the cluster administrator To enable dynamic storage provisioning based on storage class, the cluster administrator
needs to enable the `DefaultStorageClass` [admission controller](/docs/admin/admission-controllers/#defaultstorageclass) needs to enable the `DefaultStorageClass` [admission controller](/docs/admin/admission-controllers/#defaultstorageclass)
on the API server. This can be done, for example, by ensuring that `DefaultStorageClass` is on the API server. This can be done, for example, by ensuring that `DefaultStorageClass` is
among the comma-delimited, ordered list of values for the `--admission-control` flag of among the comma-delimited, ordered list of values for the `--admission-control` flag of
the API server component. For more information on API server command line flags, the API server component. For more information on API server command line flags,
please check [kube-apiserver](/docs/admin/kube-apiserver/) documentation. please check [kube-apiserver](/docs/admin/kube-apiserver/) documentation.
@@ -417,8 +417,6 @@ spec:
`PersistentVolumes` binds are exclusive, and since `PersistentVolumeClaims` are namespaced objects, mounting claims with "Many" modes (`ROX`, `RWX`) is only possible within one namespace. `PersistentVolumes` binds are exclusive, and since `PersistentVolumeClaims` are namespaced objects, mounting claims with "Many" modes (`ROX`, `RWX`) is only possible within one namespace.
``
## Writing Portable Configuration ## Writing Portable Configuration
If you're writing configuration templates or examples that run on a wide range of clusters If you're writing configuration templates or examples that run on a wide range of clusters
@@ -455,4 +453,3 @@ and need persistent storage, we recommend that you use the following pattern:
default. default.
At some point, the alpha annotation will cease to have meaning, but the unset At some point, the alpha annotation will cease to have meaning, but the unset
`storageClass` field on the PVC will have the desired effect. `storageClass` field on the PVC will have the desired effect.
@@ -40,7 +40,7 @@ If you create the ReplicaSet and then view the Pod metadata, you can see
OwnerReferences field: OwnerReferences field:
```shell ```shell
kubectl create -f https://k8s.io/docs/concepts/abstractions/controllers/my-repset.yaml kubectl create -f https://k8s.io/docs/concepts/controllers/my-repset.yaml
kubectl get pods --output=yaml kubectl get pods --output=yaml
``` ```
+6
View File
@@ -18,6 +18,12 @@ docs, follow the instructions on
**Note:** Kubernetes documentation uses [GitHub Flavored Markdown](https://github.github.com/gfm/). **Note:** Kubernetes documentation uses [GitHub Flavored Markdown](https://github.github.com/gfm/).
{: .note} {: .note}
## Language
Kubernetes documentation uses US English.
## Documentation formatting standards ## Documentation formatting standards
### Use camel case for API objects ### Use camel case for API objects
+15 -6
View File
@@ -86,15 +86,21 @@ apt-get update
apt-get install -y docker.io apt-get install -y docker.io
``` ```
or install Docker CE 17.03 from Docker's repositories for Ubuntu or Debian: or install Docker CE 17.09 from Docker's repositories for Ubuntu or Debian:
```bash ```bash
apt-get update && apt-get install -y curl apt-transport-https apt-get update
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/docker.list add-apt-repository \
deb https://download.docker.com/linux/$(lsb_release -si | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
EOF $(lsb_release -cs) \
apt-get update && apt-get install -y docker-ce=$(apt-cache madison docker-ce | grep 17.03 | head -1 | awk '{print $3}') stable"
apt-get update && apt-get install -y docker-ce=$(apt-cache madison docker-ce | grep 17.09 | head -1 | awk '{print $3}')
``` ```
{% endcapture %} {% endcapture %}
@@ -130,6 +136,9 @@ as Docker (e.g. `cgroupfs`).
{% include tabs.md %} {% include tabs.md %}
Refer to the [official Docker installation guides](https://docs.docker.com/engine/installation/)
for more information.
## Installing kubeadm, kubelet and kubectl ## Installing kubeadm, kubelet and kubectl
You will install these packages on all of your machines: You will install these packages on all of your machines:
@@ -38,7 +38,7 @@ Alternatively, you can use an existing 3rd party solution, such as [apiserver-bu
1. Create a Kubernetes service account in your namespace. 1. Create a Kubernetes service account in your namespace.
1. Create a Kubernetes cluster role for the operations you want to allow on your resources. 1. Create a Kubernetes cluster role for the operations you want to allow on your resources.
1. Create a Kubernetes cluster role binding from the default service account in your namespace to the cluster role you just created. 1. Create a Kubernetes cluster role binding from the default service account in your namespace to the cluster role you just created.
1. Create a Kubernetes apiservice. The CA cert above should be base 64 encoded, stripped of new lines and used as the spec.caBundle in the apiservce. This should not be namespaced. 1. Create a Kubernetes apiservice. The CA cert above should be base 64 encoded, stripped of new lines and used as the spec.caBundle in the apiservice. This should not be namespaced.
1. Use kubectl to get your resource. It should return "No resources found." Which means that everything worked but you currently have no objects of that resource type created yet. 1. Use kubectl to get your resource. It should return "No resources found." Which means that everything worked but you currently have no objects of that resource type created yet.
{% endcapture %} {% endcapture %}
@@ -17,7 +17,7 @@ can develop their features independantly from the core Kubernetes release cycles
Before going into how to build your own cloud controller manager, some background on how it works under the hood is helpful. The cloud controller manager is code from `kube-controller-manager` utilizing Go interfaces to allow implementations from any cloud to be plugged in. Most of the scaffolding and generic controller implementations will be in core, but it will always exec out to the cloud interfaces it is provided, so long as the [cloud provider interface](https://github.com/kubernetes/kubernetes/blob/master/pkg/cloudprovider/cloud.go#L29-L50) is satisifed. Before going into how to build your own cloud controller manager, some background on how it works under the hood is helpful. The cloud controller manager is code from `kube-controller-manager` utilizing Go interfaces to allow implementations from any cloud to be plugged in. Most of the scaffolding and generic controller implementations will be in core, but it will always exec out to the cloud interfaces it is provided, so long as the [cloud provider interface](https://github.com/kubernetes/kubernetes/blob/master/pkg/cloudprovider/cloud.go#L29-L50) is satisifed.
To dive a little deeper into implementation details, all cloud controller managers will import packages from Kubernetes core, the only difference being each project will register their own cloud providers by calling [cloudprovider.RegisterCloudProvier](https://github.com/kubernetes/kubernetes/blob/master/pkg/cloudprovider/plugins.go#L42-L52) where a global variable of available cloud providers is updated. To dive a little deeper into implementation details, all cloud controller managers will import packages from Kubernetes core, the only difference being each project will register their own cloud providers by calling [cloudprovider.RegisterCloudProvider](https://github.com/kubernetes/kubernetes/blob/master/pkg/cloudprovider/plugins.go#L42-L52) where a global variable of available cloud providers is updated.
## Developing ## Developing
@@ -67,7 +67,7 @@ status:
services.nodeports: "0" services.nodeports: "0"
``` ```
## Create a PersistentVolumeClaim: ## Create a PersistentVolumeClaim
Here is the configuration file for a PersistentVolumeClaim object: Here is the configuration file for a PersistentVolumeClaim object:
@@ -92,7 +92,7 @@ NAME STATUS
pvc-quota-demo Pending pvc-quota-demo Pending
``` ```
## Attempt to create a second PersistentVolumeClaim: ## Attempt to create a second PersistentVolumeClaim
Here is the configuration file for a second PersistentVolumeClaim: Here is the configuration file for a second PersistentVolumeClaim:
@@ -36,7 +36,9 @@ The data source corresponds to a key-value pair in the ConfigMap, where
* key = the file name or the key you provided on the command line, and * key = the file name or the key you provided on the command line, and
* value = the file contents or the literal value you provided on the command line. * value = the file contents or the literal value you provided on the command line.
You can use [`kubectl describe`](/docs/user-guide/kubectl/{{page.version}}/#describe) or [`kubectl get`](/docs/user-guide/kubectl/{{page.version}}/#get) to retrieve information about a ConfigMap. The former shows a summary of the ConfigMap, while the latter returns the full contents of the ConfigMap. You can use [`kubectl describe`](/docs/user-guide/kubectl/{{page.version}}/#describe) or
[`kubectl get`](/docs/user-guide/kubectl/{{page.version}}/#get) to retrieve information
about a ConfigMap.
### Create ConfigMaps from directories ### Create ConfigMaps from directories
@@ -16,33 +16,12 @@ your pods. But there are a number of ways to get even more information about you
For this example we'll use a Deployment to create two pods, similar to the earlier example. For this example we'll use a Deployment to create two pods, similar to the earlier example.
```yaml {% include code.html language="yaml" file="nginx-dep.yaml" ghlink="/docs/tasks/debug-application-cluster/nginx-dep.yaml" %}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 2
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
resources:
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 80
```
Copy this to a file *./my-nginx-dep.yaml* Create deployment by running following command:
```shell ```shell
$ kubectl create -f ./my-nginx-dep.yaml $ kubectl create -f https://k8s.io/docs/tasks/debug-application-cluster/nginx-dep.yaml
deployment "nginx-deployment" created deployment "nginx-deployment" created
``` ```
@@ -1,9 +1,9 @@
apiVersion: apps/v1beta1 apiVersion: extensions/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: nginx-deployment name: nginx-deployment
spec: spec:
replicas: 3 replicas: 2
template: template:
metadata: metadata:
labels: labels:
@@ -11,6 +11,10 @@ spec:
spec: spec:
containers: containers:
- name: nginx - name: nginx
image: nginx:1.7.9 image: nginx
resources:
limits:
memory: "128Mi"
cpu: "500m"
ports: ports:
- containerPort: 80 - containerPort: 80
@@ -371,44 +371,35 @@ For more information see
## Adding a cluster to a federation ## Adding a cluster to a federation
Once you've deployed a federation control plane, you'll need to make After you've deployed a federation control plane, you'll need to make that control plane aware of the clusters it should manage.
that control plane aware of the clusters it should manage. You can add
a cluster to your federation by using the [`kubefed join`](/docs/admin/kubefed_join/)
command. A new context will have been added to your kubeconfig named `fellowship`
(after the name of your federation). To join clusters into the federation, you will
need to change the context.
``` To join clusters into the federation:
kubectl config use-context fellowship
```
To use `kubefed join`, you'll need to provide the name of the cluster 1. Change the context:
you want to add to the federation, and the `--host-cluster-context`
for the federation control plane's host cluster.
> Note: The name that you provide to the `join` command is used as the kubectl config use-context fellowship
joining cluster's identity in federation. This name should adhere to
the rules described in the
[identifiers doc](/docs/concepts/overview/working-with-objects/names/). If the context
corresponding to your joining cluster conforms to these rules then you
can use the same name in the join command. Otherwise, you will have to
choose a different name for your cluster's identity. For more
information, please see the
[naming rules and customization](#naming-rules-and-customization)
section below.
The following example command adds the cluster `gondor` to the 1. If you are using a managed cluster service, allow the service to access the cluster. To do this, create a `clusterrolebinding` for the account associated with your cluster service:
federation running on host cluster `rivendell`:
``` kubectl create clusterrolebinding <your_user>-cluster-admin-binding --clusterrole=cluster-admin --user=<your_user>@example.org --context=<joining_cluster_context
kubefed join gondor --host-cluster-context=rivendell
``` 1. Join the cluster to the federation, using `kubefed join`, and make sure you provide the following:
* The name of the cluster that you are joining to the federation
* `--host-cluster-context`, the kubeconfig context for the host cluster
For example, this command adds the cluster `gondor` to the federation running on host cluster `rivendell`:
```
kubefed join gondor --host-cluster-context=rivendell
```
A new context has now been added to your kubeconfig named `fellowship` (after the name of your federation).
> Note: The name that you provide to the `join` command is used as the joining cluster's identity in federation. If this name adheres to the rules described in the [identifiers doc](/docs/concepts/overview/working-with-objects/names/). If the context
corresponding to your joining cluster conforms to these rules then you can use the same name in the join command. Otherwise, you will have to choose a different name for your cluster's identity.
> Note: Kubernetes requires that you manually join clusters to a
federation because the federation control plane manages only those
clusters that it is responsible for managing. Adding a cluster tells
the federation control plane that it is responsible for managing that
cluster.
### Naming rules and customization ### Naming rules and customization
@@ -37,7 +37,7 @@ username and password:
1. Create the Secret 1. Create the Secret
kubectl create -f secret.yaml kubectl create -f https://k8s.io/docs/tasks/inject-data-application/secret.yaml
**Note:** If you want to skip the Base64 encoding step, you can create a Secret **Note:** If you want to skip the Base64 encoding step, you can create a Secret
by using the `kubectl create secret` command: by using the `kubectl create secret` command:
@@ -81,7 +81,7 @@ Here is a configuration file you can use to create a Pod:
1. Create the Pod: 1. Create the Pod:
kubectl create -f secret-pod.yaml kubectl create -f https://k8s.io/docs/tasks/inject-data-application/secret-pod.yaml
1. Verify that your Pod is running: 1. Verify that your Pod is running:
@@ -128,7 +128,7 @@ Here is a configuration file you can use to create a Pod:
1. Create the Pod: 1. Create the Pod:
kubectl create -f secret-envars-pod.yaml kubectl create -f https://k8s.io/docs/tasks/inject-data-application/secret-envars-pod.yaml
1. Verify that your Pod is running: 1. Verify that your Pod is running:
@@ -10,7 +10,7 @@ metadata:
spec: spec:
containers: containers:
- name: website - name: website
image: ecorp/website image: nginx
volumeMounts: volumeMounts:
- mountPath: /cache - mountPath: /cache
name: cache-volume name: cache-volume
@@ -2,7 +2,6 @@ apiVersion: settings.k8s.io/v1alpha1
kind: PodPreset kind: PodPreset
metadata: metadata:
name: allow-database name: allow-database
namespace: myns
spec: spec:
selector: selector:
matchLabels: matchLabels:
@@ -8,7 +8,7 @@ metadata:
spec: spec:
containers: containers:
- name: website - name: website
image: ecorp/website image: nginx
volumeMounts: volumeMounts:
- mountPath: /cache - mountPath: /cache
name: cache-volume name: cache-volume
@@ -2,7 +2,6 @@ apiVersion: settings.k8s.io/v1alpha1
kind: PodPreset kind: PodPreset
metadata: metadata:
name: allow-database name: allow-database
namespace: myns
spec: spec:
selector: selector:
matchLabels: matchLabels:
@@ -10,7 +10,7 @@ metadata:
spec: spec:
containers: containers:
- name: website - name: website
image: ecorp/website image: nginx
volumeMounts: volumeMounts:
- mountPath: /cache - mountPath: /cache
name: cache-volume name: cache-volume
@@ -11,7 +11,7 @@ metadata:
spec: spec:
containers: containers:
- name: website - name: website
image: ecorp/website image: nginx
volumeMounts: volumeMounts:
- mountPath: /cache - mountPath: /cache
name: cache-volume name: cache-volume
@@ -8,7 +8,7 @@ metadata:
spec: spec:
containers: containers:
- name: website - name: website
image: ecorp/website image: nginx
ports: ports:
- containerPort: 80 - containerPort: 80
@@ -2,7 +2,6 @@ apiVersion: settings.k8s.io/v1alpha1
kind: PodPreset kind: PodPreset
metadata: metadata:
name: allow-database name: allow-database
namespace: myns
spec: spec:
selector: selector:
matchLabels: matchLabels:
@@ -2,7 +2,6 @@ apiVersion: settings.k8s.io/v1alpha1
kind: PodPreset kind: PodPreset
metadata: metadata:
name: proxy name: proxy
namespace: myns
spec: spec:
selector: selector:
matchLabels: matchLabels:
@@ -20,18 +20,50 @@ You can get an overview of PodPresets at
This is a simple example to show how a Pod spec is modified by the Pod This is a simple example to show how a Pod spec is modified by the Pod
Preset. Preset.
**User submitted pod spec:** {% include code.html language="yaml" file="podpreset-preset.yaml" ghlink="/docs/tasks/inject-data-application/podpreset-preset.yaml" %}
Create the PodPreset:
```shell
kubectl create -f https://k8s.io/docs/tasks/inject-data-application/podpreset-preset.yaml
```
Examine the created PodPreset:
```shell
$ kubectl get podpreset
NAME AGE
allow-database 1m
```
The new PodPreset will act upon any pod that has label `role: frontend`.
{% include code.html language="yaml" file="podpreset-pod.yaml" ghlink="/docs/tasks/inject-data-application/podpreset-pod.yaml" %} {% include code.html language="yaml" file="podpreset-pod.yaml" ghlink="/docs/tasks/inject-data-application/podpreset-pod.yaml" %}
**Example Pod Preset:** Create a pod:
{% include code.html language="yaml" file="podpreset-preset.yaml" ghlink="/docs/tasks/inject-data-application/podpreset-preset.yaml" %} ```shell
$ kubectl create -f https://k8s.io/docs/tasks/inject-data-application/podpreset-pod.yaml
```
List the running Pods:
```shell
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
website 1/1 Running 0 4m
```
**Pod spec after admission controller:** **Pod spec after admission controller:**
{% include code.html language="yaml" file="podpreset-merged.yaml" ghlink="/docs/tasks/inject-data-application/podpreset-merged.yaml" %} {% include code.html language="yaml" file="podpreset-merged.yaml" ghlink="/docs/tasks/inject-data-application/podpreset-merged.yaml" %}
To see above output, run the following command:
```shell
$ kubectl get pod website -o yaml
```
### Pod Spec with `ConfigMap` Example ### Pod Spec with `ConfigMap` Example
This is an example to show how a Pod spec is modified by the Pod Preset This is an example to show how a Pod spec is modified by the Pod Preset
@@ -113,7 +145,7 @@ when there is a conflict.
**If we run `kubectl describe...` we can see the event:** **If we run `kubectl describe...` we can see the event:**
``` ```shell
$ kubectl describe ... $ kubectl describe ...
.... ....
Events: Events:
@@ -100,7 +100,7 @@ Open a command terminal, and use
manifest. manifest.
```shell ```shell
kubectl apply -f https://k8s.io/docs/tutorials/stateful-application/zookeeper.yaml kubectl apply -f https://raw.githubusercontent.com/kubernetes/website/master/docs/tutorials/stateful-application/zookeeper.yaml
``` ```
This creates the `zk-hs` Headless Service, the `zk-cs` Service, This creates the `zk-hs` Headless Service, the `zk-cs` Service,
+11
View File
@@ -264,6 +264,17 @@ $ kubectl describe pods <rc-name>
$ kubectl describe pods --include-uninitialized=false $ kubectl describe pods --include-uninitialized=false
``` ```
**Note:** The `kubectl get` command is usually used for retrieving one or more
resources of the same resource type. It features a rich set of flags that allows
you to customize the output format using the `-o` or `--output` flag, for example.
You can specify the `-w` or `--watch` flag to start watching updates to a particular
object. The `kubectl describe` command is more focused on describing the many
related aspects of a specified resource. It may invoke several API calls to the
API server to build a view for the user. For example, the `kubectl describe node`
command retrieves not only the information about the node, but also a summary of
the pods running on it, the events generated for the node etc.
{: .note}
`kubectl delete` - Delete resources either from a file, stdin, or specifying label selectors, names, resource selectors, or resources. `kubectl delete` - Delete resources either from a file, stdin, or specifying label selectors, names, resource selectors, or resources.
```shell ```shell
+2 -2
View File
@@ -97,8 +97,8 @@ volumes:
```yaml ```yaml
volumeMounts: volumeMounts:
# name must match the volume name below    # name must match the volume name defined in volumes
- name: redis-persistent-storage    - name: redis-persistent-storage
# mount path within the container # mount path within the container
mountPath: /data/redis mountPath: /data/redis
``` ```
Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

+1 -1
View File
@@ -64,7 +64,7 @@ cid: home
<button id="desktopShowVideoButton" onclick="kub.showVideo()">Watch Video</button> <button id="desktopShowVideoButton" onclick="kub.showVideo()">Watch Video</button>
<br> <br>
<br> <br>
<a href="https://goo.gl/nhbhXw" button id= "desktopKCButton">Attend KubeCon in Austin, TX on December 6-8, 2017</a> <a href="https://goo.gl/naJfWk" button id= "desktopKCButton">Attend KubeCon in Austin, TX on December 6-8, 2017</a>
</div> </div>
<button id="mobileShowVideoButton" onclick="kub.showVideo()"></button> <button id="mobileShowVideoButton" onclick="kub.showVideo()"></button>
</section> </section>
+5 -5
View File
@@ -22,8 +22,8 @@ cid: partners
</div> </div>
<div class="kscp_section"> <div class="kscp_section">
<h3><a id="kcsp"></a>Kubernetes Certified Service Providers (KCSP)</h3> <h3><a id="kcsp"></a>Kubernetes Certified Service Providers (KCSP)</h3>
<p>The KCSP program is a vetted tier of service providers who have deep experience helping enterprises successfully adopt Kubernetes. KCSP partners offer Kubernetes support, consulting, professional services and training for organizations embarking on their Kubernetes journey.</p> <p>The KCSP program is a vetted tier of service providers who have deep experience helping enterprises successfully adopt Kubernetes. KCSP partners offer Kubernetes support, consulting, professional services and training for organizations embarking on their Kubernetes journey. Learn more about the program <b><a href="https://www.cncf.io/certification/kcsp/">here</a></b>.</p>
<p>Interested in becoming a KCSP? <b><a href="https://www.cncf.io/certification/kcsp/">Learn more.</a></b></p> <p>Interested in becoming a KCSP? Please <b><a href="https://goo.gl/forms/lwKx3U24oIumFXvM2">fill out this form.</a></b></p>
<div id="kcspContainer"></div> <div id="kcspContainer"></div>
</div> </div>
<div class="dist_section"> <div class="dist_section">
@@ -35,13 +35,13 @@ cid: partners
<div class="tech_section"> <div class="tech_section">
<h3><a id="technology"></a>Technology Partners</h3> <h3><a id="technology"></a>Technology Partners</h3>
<p>Technology partners offer integrations and plugins that add features to Kubernetes applications.</p> <p>Technology partners offer integrations and plugins that add features to Kubernetes applications.</p>
<p>Interested in becoming a Technology Partner? Please <b><a href="https://docs.google.com/forms/d/e/1FAIpQLSdN1KtSKX2VAOPGABFlShkSd6CajQynoL4QCVtY0dj76MNDKg/viewform">fill out this form.</a></b></p> <p>Interested in becoming a Technology Partner? Please <b><a href="https://goo.gl/forms/lwKx3U24oIumFXvM2">fill out this form.</a></b></p>
<div id="isvContainer"></div> <div id="isvContainer"></div>
</div> </div>
<div class="service_Section"> <div class="service_Section">
<h3><a id="service"></a>Service Partners</h3> <h3><a id="service"></a>Service Partners</h3>
<p>Service Partners offer consulting or management services to help companies implement and use Kubernetes in commercial applications.</p> <p>Service Partners offer consulting or management services to help companies implement and use Kubernetes in commercial applications.</p>
<p>Interested in becoming a Service Provider? Please <b><a href="https://docs.google.com/forms/d/e/1FAIpQLSdN1KtSKX2VAOPGABFlShkSd6CajQynoL4QCVtY0dj76MNDKg/viewform">fill out this form</a></b></p> <p>Interested in becoming a Service Provider? Please <b><a href="https://goo.gl/forms/lwKx3U24oIumFXvM2">fill out this form.</a></b></p>
<div id="servContainer"></div> <div id="servContainer"></div>
</div> </div>
</main> </main>
@@ -53,4 +53,4 @@ cid: partners
<script> <script>
{% include partner-script.js %} {% include partner-script.js %}
</script> </script>
+127 -69
View File
@@ -32,15 +32,17 @@ import (
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/validation/field" "k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/apimachinery/pkg/util/yaml" "k8s.io/apimachinery/pkg/util/yaml"
api "k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/apis/core/validation"
"k8s.io/kubernetes/pkg/apis/apps" "k8s.io/kubernetes/pkg/apis/apps"
apps_validation "k8s.io/kubernetes/pkg/apis/apps/validation" apps_validation "k8s.io/kubernetes/pkg/apis/apps/validation"
"k8s.io/kubernetes/pkg/apis/autoscaling"
autoscaling_validation "k8s.io/kubernetes/pkg/apis/autoscaling/validation"
"k8s.io/kubernetes/pkg/apis/batch" "k8s.io/kubernetes/pkg/apis/batch"
batch_validation "k8s.io/kubernetes/pkg/apis/batch/validation" batch_validation "k8s.io/kubernetes/pkg/apis/batch/validation"
api "k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/apis/core/validation"
"k8s.io/kubernetes/pkg/apis/extensions" "k8s.io/kubernetes/pkg/apis/extensions"
expvalidation "k8s.io/kubernetes/pkg/apis/extensions/validation" ext_validation "k8s.io/kubernetes/pkg/apis/extensions/validation"
"k8s.io/kubernetes/pkg/apis/policy" "k8s.io/kubernetes/pkg/apis/policy"
policyvalidation "k8s.io/kubernetes/pkg/apis/policy/validation" policyvalidation "k8s.io/kubernetes/pkg/apis/policy/validation"
"k8s.io/kubernetes/pkg/apis/storage" "k8s.io/kubernetes/pkg/apis/storage"
@@ -113,11 +115,21 @@ func validateObject(obj runtime.Object) (errors field.ErrorList) {
t.Namespace = api.NamespaceDefault t.Namespace = api.NamespaceDefault
} }
errors = validation.ValidateResourceQuota(t) errors = validation.ValidateResourceQuota(t)
case *autoscaling.HorizontalPodAutoscaler:
if t.Namespace == "" {
t.Namespace = api.NamespaceDefault
}
errors = autoscaling_validation.ValidateHorizontalPodAutoscaler(t)
case *extensions.Deployment: case *extensions.Deployment:
if t.Namespace == "" { if t.Namespace == "" {
t.Namespace = api.NamespaceDefault t.Namespace = api.NamespaceDefault
} }
errors = expvalidation.ValidateDeployment(t) errors = ext_validation.ValidateDeployment(t)
case *extensions.ReplicaSet:
if t.Namespace == "" {
t.Namespace = api.NamespaceDefault
}
errors = ext_validation.ValidateReplicaSet(t)
case *batch.Job: case *batch.Job:
if t.Namespace == "" { if t.Namespace == "" {
t.Namespace = api.NamespaceDefault t.Namespace = api.NamespaceDefault
@@ -130,14 +142,14 @@ func validateObject(obj runtime.Object) (errors field.ErrorList) {
if t.Namespace == "" { if t.Namespace == "" {
t.Namespace = api.NamespaceDefault t.Namespace = api.NamespaceDefault
} }
errors = expvalidation.ValidateIngress(t) errors = ext_validation.ValidateIngress(t)
case *extensions.DaemonSet: case *extensions.DaemonSet:
if t.Namespace == "" { if t.Namespace == "" {
t.Namespace = api.NamespaceDefault t.Namespace = api.NamespaceDefault
} }
errors = expvalidation.ValidateDaemonSet(t) errors = ext_validation.ValidateDaemonSet(t)
case *extensions.PodSecurityPolicy: case *extensions.PodSecurityPolicy:
errors = expvalidation.ValidatePodSecurityPolicy(t) errors = ext_validation.ValidatePodSecurityPolicy(t)
case *batch.CronJob: case *batch.CronJob:
if t.Namespace == "" { if t.Namespace == "" {
t.Namespace = api.NamespaceDefault t.Namespace = api.NamespaceDefault
@@ -218,45 +230,76 @@ func walkConfigFiles(inDir string, fn func(name, path string, data [][]byte)) er
} }
func TestExampleObjectSchemas(t *testing.T) { func TestExampleObjectSchemas(t *testing.T) {
// Please help maintain the alphabeta order in the map
cases := map[string]map[string][]runtime.Object{ cases := map[string]map[string][]runtime.Object{
"../docs/user-guide/walkthrough": { "../docs/admin/high-availability": {
"deployment": {&extensions.Deployment{}}, "etcd": {&api.Pod{}},
"deployment-update": {&extensions.Deployment{}}, "kube-apiserver": {&api.Pod{}},
"pod-nginx": {&api.Pod{}}, "kube-controller-manager": {&api.Pod{}},
"pod-nginx-with-label": {&api.Pod{}}, "kube-scheduler": {&api.Pod{}},
"pod-redis": {&api.Pod{}}, "podmaster": {&api.Pod{}},
"pod-with-http-healthcheck": {&api.Pod{}},
"pod-with-tcp-socket-healthcheck": {&api.Pod{}},
"podtemplate": {&api.PodTemplate{}},
"service": {&api.Service{}},
}, },
"../docs/user-guide/update-demo": { "../docs/admin/limitrange": {
"kitten-rc": {&api.ReplicationController{}}, "invalid-pod": {&api.Pod{}},
"nautilus-rc": {&api.ReplicationController{}}, "limits": {&api.LimitRange{}},
"namespace": {&api.Namespace{}},
"valid-pod": {&api.Pod{}},
},
"../docs/admin/multiple-schedulers": {
"my-scheduler": {&extensions.Deployment{}},
"pod1": {&api.Pod{}},
"pod2": {&api.Pod{}},
"pod3": {&api.Pod{}},
},
"../docs/admin/namespaces": {
"namespace-dev": {&api.Namespace{}},
"namespace-prod": {&api.Namespace{}},
},
"../docs/admin/resourcequota": {
"best-effort": {&api.ResourceQuota{}},
"compute-resources": {&api.ResourceQuota{}},
"limits": {&api.LimitRange{}},
"namespace": {&api.Namespace{}},
"not-best-effort": {&api.ResourceQuota{}},
"object-counts": {&api.ResourceQuota{}},
},
"../docs/concepts/cluster-administration": {
"counter-pod": {&api.Pod{}},
"fluentd-sidecar-config": {&api.ConfigMap{}},
"nginx-app": {&api.Service{}, &extensions.Deployment{}},
"two-files-counter-pod": {&api.Pod{}},
"two-files-counter-pod-agent-sidecar": {&api.Pod{}},
"two-files-counter-pod-streaming-sidecar": {&api.Pod{}},
},
"../docs/concepts/configuration": {
"commands": {&api.Pod{}},
"pod": {&api.Pod{}},
"pod-with-node-affinity": {&api.Pod{}},
"pod-with-pod-affinity": {&api.Pod{}},
},
"../docs/concepts/overview/working-with-objects": {
"nginx-deployment": {&extensions.Deployment{}},
}, },
"../docs/concepts/policy": { "../docs/concepts/policy": {
"psp": {&extensions.PodSecurityPolicy{}}, "psp": {&extensions.PodSecurityPolicy{}},
}, },
"../docs/user-guide/persistent-volumes/volumes": { "../docs/concepts/services-networking": {
"local-01": {&api.PersistentVolume{}}, "curlpod": {&extensions.Deployment{}},
"local-02": {&api.PersistentVolume{}}, "hostaliases-pod": {&api.Pod{}},
"gce": {&api.PersistentVolume{}}, "ingress": {&extensions.Ingress{}},
"nfs": {&api.PersistentVolume{}}, "nginx-secure-app": {&api.Service{}, &extensions.Deployment{}},
"nginx-svc": {&api.Service{}},
"run-my-nginx": {&extensions.Deployment{}},
}, },
"../docs/user-guide/persistent-volumes/claims": { "../docs/concepts/workloads/controllers": {
"claim-01": {&api.PersistentVolumeClaim{}}, "cronjob": {&batch.CronJob{}},
"claim-02": {&api.PersistentVolumeClaim{}}, "daemonset": {&extensions.DaemonSet{}},
"claim-03": {&api.PersistentVolumeClaim{}}, "frontend": {&extensions.ReplicaSet{}},
}, "hpa-rs": {&autoscaling.HorizontalPodAutoscaler{}},
"../docs/user-guide/persistent-volumes/simpletest": { "job": {&batch.Job{}},
"namespace": {&api.Namespace{}}, "my-repset": {&extensions.ReplicaSet{}},
"pod": {&api.Pod{}}, "nginx-deployment": {&extensions.Deployment{}},
"service": {&api.Service{}}, "replication": {&api.ReplicationController{}},
},
"../docs/user-guide/liveness": {
"exec-liveness": {&api.Pod{}},
"http-liveness": {&api.Pod{}},
"http-liveness-named-port": {&api.Pod{}},
}, },
"../docs/tasks/job/coarse-parallel-processing-work-queue": { "../docs/tasks/job/coarse-parallel-processing-work-queue": {
"job": {&batch.Job{}}, "job": {&batch.Job{}},
@@ -266,6 +309,18 @@ func TestExampleObjectSchemas(t *testing.T) {
"redis-pod": {&api.Pod{}}, "redis-pod": {&api.Pod{}},
"redis-service": {&api.Service{}}, "redis-service": {&api.Service{}},
}, },
"../docs/tutorials/stateful-application": {
"gce-volume": {&api.PersistentVolume{}},
"mysql-deployment": {&api.Service{}, &api.PersistentVolumeClaim{}, &extensions.Deployment{}},
"mysql-services": {&api.Service{}, &api.Service{}},
"mysql-configmap": {&api.ConfigMap{}},
"mysql-statefulset": {&apps.StatefulSet{}},
"cassandra-service": {&api.Service{}},
"cassandra-statefulset": {&apps.StatefulSet{}, &storage.StorageClass{}},
"web": {&api.Service{}, &apps.StatefulSet{}},
"webp": {&api.Service{}, &apps.StatefulSet{}},
"zookeeper": {&api.Service{}, &api.Service{}, &policy.PodDisruptionBudget{}, &apps.StatefulSet{}},
},
"../docs/user-guide": { "../docs/user-guide": {
"bad-nginx-deployment": {&extensions.Deployment{}}, "bad-nginx-deployment": {&extensions.Deployment{}},
"counter-pod": {&api.Pod{}}, "counter-pod": {&api.Pod{}},
@@ -290,9 +345,6 @@ func TestExampleObjectSchemas(t *testing.T) {
"run-my-nginx": {&extensions.Deployment{}}, "run-my-nginx": {&extensions.Deployment{}},
"cronjob": {&batch.CronJob{}}, "cronjob": {&batch.CronJob{}},
}, },
"../docs/admin": {
"daemon": {&extensions.DaemonSet{}},
},
"../docs/user-guide/downward-api": { "../docs/user-guide/downward-api": {
"dapi-pod": {&api.Pod{}}, "dapi-pod": {&api.Pod{}},
"dapi-container-resources": {&api.Pod{}}, "dapi-container-resources": {&api.Pod{}},
@@ -301,45 +353,51 @@ func TestExampleObjectSchemas(t *testing.T) {
"dapi-volume": {&api.Pod{}}, "dapi-volume": {&api.Pod{}},
"dapi-volume-resources": {&api.Pod{}}, "dapi-volume-resources": {&api.Pod{}},
}, },
"../docs/admin/namespaces": { "../docs/user-guide/liveness": {
"namespace-dev": {&api.Namespace{}}, "exec-liveness": {&api.Pod{}},
"namespace-prod": {&api.Namespace{}}, "http-liveness": {&api.Pod{}},
}, "http-liveness-named-port": {&api.Pod{}},
"../docs/admin/limitrange": {
"invalid-pod": {&api.Pod{}},
"limits": {&api.LimitRange{}},
"namespace": {&api.Namespace{}},
"valid-pod": {&api.Pod{}},
}, },
"../docs/user-guide/node-selection": { "../docs/user-guide/node-selection": {
"pod": {&api.Pod{}}, "pod": {&api.Pod{}},
"pod-with-node-affinity": {&api.Pod{}}, "pod-with-node-affinity": {&api.Pod{}},
"pod-with-pod-affinity": {&api.Pod{}}, "pod-with-pod-affinity": {&api.Pod{}},
}, },
"../docs/admin/resourcequota": { "../docs/user-guide/persistent-volumes/volumes": {
"best-effort": {&api.ResourceQuota{}}, "local-01": {&api.PersistentVolume{}},
"compute-resources": {&api.ResourceQuota{}}, "local-02": {&api.PersistentVolume{}},
"limits": {&api.LimitRange{}}, "gce": {&api.PersistentVolume{}},
"namespace": {&api.Namespace{}}, "nfs": {&api.PersistentVolume{}},
"not-best-effort": {&api.ResourceQuota{}}, },
"object-counts": {&api.ResourceQuota{}}, "../docs/user-guide/persistent-volumes/claims": {
"claim-01": {&api.PersistentVolumeClaim{}},
"claim-02": {&api.PersistentVolumeClaim{}},
"claim-03": {&api.PersistentVolumeClaim{}},
},
"../docs/user-guide/persistent-volumes/simpletest": {
"namespace": {&api.Namespace{}},
"pod": {&api.Pod{}},
"service": {&api.Service{}},
}, },
"../docs/user-guide/secrets": { "../docs/user-guide/secrets": {
"secret-pod": {&api.Pod{}}, "secret-pod": {&api.Pod{}},
"secret": {&api.Secret{}}, "secret": {&api.Secret{}},
"secret-env-pod": {&api.Pod{}}, "secret-env-pod": {&api.Pod{}},
}, },
"../docs/tutorials/stateful-application": { "../docs/user-guide/update-demo": {
"gce-volume": {&api.PersistentVolume{}}, "kitten-rc": {&api.ReplicationController{}},
"mysql-deployment": {&api.Service{}, &api.PersistentVolumeClaim{}, &extensions.Deployment{}}, "nautilus-rc": {&api.ReplicationController{}},
"mysql-services": {&api.Service{}, &api.Service{}}, },
"mysql-configmap": {&api.ConfigMap{}}, "../docs/user-guide/walkthrough": {
"mysql-statefulset": {&apps.StatefulSet{}}, "deployment": {&extensions.Deployment{}},
"cassandra-service": {&api.Service{}}, "deployment-update": {&extensions.Deployment{}},
"cassandra-statefulset": {&apps.StatefulSet{}, &storage.StorageClass{}}, "pod-nginx": {&api.Pod{}},
"web": {&api.Service{}, &apps.StatefulSet{}}, "pod-nginx-with-label": {&api.Pod{}},
"webp": {&api.Service{}, &apps.StatefulSet{}}, "pod-redis": {&api.Pod{}},
"zookeeper": {&api.Service{}, &api.Service{}, &policy.PodDisruptionBudget{}, &apps.StatefulSet{}}, "pod-with-http-healthcheck": {&api.Pod{}},
"pod-with-tcp-socket-healthcheck": {&api.Pod{}},
"podtemplate": {&api.PodTemplate{}},
"service": {&api.Service{}},
}, },
} }