Merge branch 'master' into release-1.8
This commit is contained in:
@@ -127,7 +127,7 @@ commands.
|
|||||||
|
|
||||||
In addition to authentication, the tokens can be used to sign a ConfigMap. This
|
In addition to authentication, the tokens can be used to sign a ConfigMap. This
|
||||||
is used early in a cluster bootstrap process before the client trusts the API
|
is used early in a cluster bootstrap process before the client trusts the API
|
||||||
server. The signed ConfigMap can be authenicated by the shared token.
|
server. The signed ConfigMap can be authenticated by the shared token.
|
||||||
|
|
||||||
The ConfigMap that is signed is `cluster-info` in the `kube-public` namespace.
|
The ConfigMap that is signed is `cluster-info` in the `kube-public` namespace.
|
||||||
The typical flow is that a client reads this ConfigMap while unauthenticated and
|
The typical flow is that a client reads this ConfigMap while unauthenticated and
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ For self-registration, the kubelet is started with the following options:
|
|||||||
- `--kubeconfig` - Path to credentials to authenticate itself to the apiserver.
|
- `--kubeconfig` - Path to credentials to authenticate itself to the apiserver.
|
||||||
- `--cloud-provider` - How to talk to a cloud provider to read metadata about itself.
|
- `--cloud-provider` - How to talk to a cloud provider to read metadata about itself.
|
||||||
- `--register-node` - Automatically register with the API server.
|
- `--register-node` - Automatically register with the API server.
|
||||||
- `--register-with-taints` - Register the node with the given list of taints (comma seperated `<key>=<value>:<effect>`). No-op if `register-node` is false.
|
- `--register-with-taints` - Register the node with the given list of taints (comma separated `<key>=<value>:<effect>`). No-op if `register-node` is false.
|
||||||
- `--node-ip` IP address of the node.
|
- `--node-ip` IP address of the node.
|
||||||
- `--node-labels` - Labels to add when registering the node in the cluster.
|
- `--node-labels` - Labels to add when registering the node in the cluster.
|
||||||
- `--node-status-update-frequency` - Specifies how often kubelet posts node status to master.
|
- `--node-status-update-frequency` - Specifies how often kubelet posts node status to master.
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ Highly Available database statefulset has one master and three replicas, one may
|
|||||||
|:--------------------:|:-------------------:|:------------------:|:------------------:|
|
|:--------------------:|:-------------------:|:------------------:|:------------------:|
|
||||||
| *DB-MASTER* | *DB-REPLICA-1* | *DB-REPLICA-2* | *DB-REPLICA-3* |
|
| *DB-MASTER* | *DB-REPLICA-1* | *DB-REPLICA-2* | *DB-REPLICA-3* |
|
||||||
|
|
||||||
[Here](https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/#tolerating-node-failure) is an example of zookeper statefulset configured with anti-affinity for high availablity.
|
[Here](https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/#tolerating-node-failure) is an example of zookeper statefulset configured with anti-affinity for high availability.
|
||||||
|
|
||||||
For more information on inter-pod affinity/anti-affinity, see the design doc
|
For more information on inter-pod affinity/anti-affinity, see the design doc
|
||||||
[here](https://git.k8s.io/community/contributors/design-proposals/podaffinity.md).
|
[here](https://git.k8s.io/community/contributors/design-proposals/podaffinity.md).
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ To work with Kubernetes objects--whether to create, modify, or delete them--you'
|
|||||||
|
|
||||||
### Object Spec and Status
|
### Object Spec and Status
|
||||||
|
|
||||||
Every Kubernetes object includes two nested object fields that govern the object's configuration: the object *spec* and the object *status*. The *spec*, which you must provide, describes your *desired state* for the object--the characteristics that you want the object to have. The *status* describes the *actual state* for the object, and is supplied and updated by the Kubernetes system. At any given time, the Kubernetes Control Plane actively manages an object's actual state to match the desired state you supplied.
|
Every Kubernetes object includes two nested object fields that govern the object's configuration: the object *spec* and the object *status*. The *spec*, which you must provide, describes your *desired state* for the object--the characteristics that you want the object to have. The *status* describes the *actual state* of the object, and is supplied and updated by the Kubernetes system. At any given time, the Kubernetes Control Plane actively manages an object's actual state to match the desired state you supplied.
|
||||||
|
|
||||||
|
|
||||||
For example, a Kubernetes Deployment is an object that can represent an application running on your cluster. When you create the Deployment, you might set the Deployment spec to specify that you want three replicas of the application to be running. The Kubernetes system reads the Deployment spec and starts three instances of your desired application--updating the status to match your spec. If any of those instances should fail (a status change), the Kubernetes system responds to the difference between spec and status by making a correction--in this case, starting a replacement instance.
|
For example, a Kubernetes Deployment is an object that can represent an application running on your cluster. When you create the Deployment, you might set the Deployment spec to specify that you want three replicas of the application to be running. The Kubernetes system reads the Deployment spec and starts three instances of your desired application--updating the status to match your spec. If any of those instances should fail (a status change), the Kubernetes system responds to the difference between spec and status by making a correction--in this case, starting a replacement instance.
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ These are just examples of commonly used labels; you are free to develop your ow
|
|||||||
## Syntax and character set
|
## Syntax and character set
|
||||||
|
|
||||||
_Labels_ are key value pairs. Valid label keys have two segments: an optional prefix and name, separated by a slash (`/`). The name segment is required and must be 63 characters or less, beginning and ending with an alphanumeric character (`[a-z0-9A-Z]`) with dashes (`-`), underscores (`_`), dots (`.`), and alphanumerics between. The prefix is optional. If specified, the prefix must be a DNS subdomain: a series of DNS labels separated by dots (`.`), not longer than 253 characters in total, followed by a slash (`/`).
|
_Labels_ are key value pairs. Valid label keys have two segments: an optional prefix and name, separated by a slash (`/`). The name segment is required and must be 63 characters or less, beginning and ending with an alphanumeric character (`[a-z0-9A-Z]`) with dashes (`-`), underscores (`_`), dots (`.`), and alphanumerics between. The prefix is optional. If specified, the prefix must be a DNS subdomain: a series of DNS labels separated by dots (`.`), not longer than 253 characters in total, followed by a slash (`/`).
|
||||||
If the prefix is omitted, the label key is presumed to be private to the user. Automated system components (e.g. `kube-scheduler`, `kube-controller-manager`, `kube-apiserver`, `kubectl`, or other third-party automation) which add labels to end-user objects must specify a prefix. The `kubernetes.io/` prefix is reserved for Kubernetes core components.
|
If the prefix is omitted, the label Key is presumed to be private to the user. Automated system components (e.g. `kube-scheduler`, `kube-controller-manager`, `kube-apiserver`, `kubectl`, or other third-party automation) which add labels to end-user objects must specify a prefix. The `kubernetes.io/` prefix is reserved for Kubernetes core components.
|
||||||
|
|
||||||
Valid label values must be 63 characters or less and must be empty or begin and end with an alphanumeric character (`[a-z0-9A-Z]`) with dashes (`-`), underscores (`_`), dots (`.`), and alphanumerics between.
|
Valid label values must be 63 characters or less and must be empty or begin and end with an alphanumeric character (`[a-z0-9A-Z]`) with dashes (`-`), underscores (`_`), dots (`.`), and alphanumerics between.
|
||||||
|
|
||||||
|
|||||||
@@ -15,4 +15,4 @@ Names are generally client-provided. Only one object of a given kind can have a
|
|||||||
|
|
||||||
## UIDs
|
## UIDs
|
||||||
|
|
||||||
UID are generated by Kubernetes. Every object created over the whole lifetime of a Kubernetes cluster has a distinct UID (i.e., they are spatially and temporally unique).
|
UIDs are generated by Kubernetes. Every object created over the whole lifetime of a Kubernetes cluster has a distinct UID (i.e., they are spatially and temporally unique).
|
||||||
|
|||||||
@@ -435,7 +435,24 @@ In a split-horizon DNS environment you would need two services to be able to rou
|
|||||||
|
|
||||||
This can be achieved by adding the following annotations to the service based on cloud provider.
|
This can be achieved by adding the following annotations to the service based on cloud provider.
|
||||||
|
|
||||||
For AWS:
|
{% capture default_tab %}
|
||||||
|
Select one of the tabs.
|
||||||
|
{% endcapture %}
|
||||||
|
|
||||||
|
{% capture gcp %}
|
||||||
|
```yaml
|
||||||
|
[...]
|
||||||
|
metadata:
|
||||||
|
name: my-service
|
||||||
|
annotations:
|
||||||
|
cloud.google.com/load-balancer-type: "internal"
|
||||||
|
[...]
|
||||||
|
```
|
||||||
|
|
||||||
|
For more information, see the [docs](https://cloud.google.com/container-engine/docs/internal-load-balancing).
|
||||||
|
{% endcapture %}
|
||||||
|
|
||||||
|
{% capture aws %}
|
||||||
```yaml
|
```yaml
|
||||||
[...]
|
[...]
|
||||||
metadata:
|
metadata:
|
||||||
@@ -444,8 +461,9 @@ metadata:
|
|||||||
service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
|
service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
|
||||||
[...]
|
[...]
|
||||||
```
|
```
|
||||||
|
{% endcapture %}
|
||||||
|
|
||||||
For Azure:
|
{% capture azure %}
|
||||||
```yaml
|
```yaml
|
||||||
[...]
|
[...]
|
||||||
metadata:
|
metadata:
|
||||||
@@ -454,7 +472,11 @@ metadata:
|
|||||||
service.beta.kubernetes.io/azure-load-balancer-internal: "true"
|
service.beta.kubernetes.io/azure-load-balancer-internal: "true"
|
||||||
[...]
|
[...]
|
||||||
```
|
```
|
||||||
|
{% endcapture %}
|
||||||
|
|
||||||
|
{% assign tab_names = 'Default,GCP,AWS,Azure' | split: ',' | compact %}
|
||||||
|
{% assign tab_contents = site.emptyArray | push: default_tab | push: gcp | push: aws | push: azure %}
|
||||||
|
{% include tabs.md %}
|
||||||
|
|
||||||
#### SSL support on AWS
|
#### SSL support on AWS
|
||||||
For partial SSL support on clusters running on AWS, starting with 1.3 two
|
For partial SSL support on clusters running on AWS, starting with 1.3 two
|
||||||
|
|||||||
@@ -322,10 +322,10 @@ See the [iSCSI example](https://github.com/kubernetes/kubernetes/tree/{{page.git
|
|||||||
|
|
||||||
### fc (fibre channel)
|
### fc (fibre channel)
|
||||||
|
|
||||||
An `fc` volume allows an existing fibre channel volume to be mounted into your pod.
|
An `fc` volume allows an existing fibre channel volume to be mounted in a pod.
|
||||||
You can specify single or multiple target World Wide Names to the parameter
|
You can specify single or multiple target World Wide Names using the parameter
|
||||||
targetWWNs in your volume configuration. If multiple WWNs are specified,
|
`targetWWNs` in your volume configuration. If multiple WWNs are specified,
|
||||||
targetWWNs expects that those WWNs form multipath connection.
|
targetWWNs expect that those WWNs are from multi-path connections.
|
||||||
|
|
||||||
__Important: You must configure FC SAN Zoning to allocate and mask those
|
__Important: You must configure FC SAN Zoning to allocate and mask those
|
||||||
LUNs (volumes) to the target WWNs beforehand so that Kubernetes hosts
|
LUNs (volumes) to the target WWNs beforehand so that Kubernetes hosts
|
||||||
@@ -693,7 +693,7 @@ spec:
|
|||||||
fsType: xfs
|
fsType: xfs
|
||||||
```
|
```
|
||||||
|
|
||||||
For further detail, plese the see the [ScaleIO examples](https://github.com/kubernetes/kubernetes/tree/{{page.githubbranch}}/examples/volumes/scaleio).
|
For further detail, please the see the [ScaleIO examples](https://github.com/kubernetes/kubernetes/tree/{{page.githubbranch}}/examples/volumes/scaleio).
|
||||||
|
|
||||||
### StorageOS
|
### StorageOS
|
||||||
A `storageos` volume allows an existing [StorageOS](https://www.storageos.com) volume to be mounted into your pod.
|
A `storageos` volume allows an existing [StorageOS](https://www.storageos.com) volume to be mounted into your pod.
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ represents.
|
|||||||
|
|
||||||
1. Display information about a pod:
|
1. Display information about a pod:
|
||||||
|
|
||||||
kubectl describe pod <pod-name>
|
kubectl describe pod <pod-name>
|
||||||
|
|
||||||
where `<pod-name>` is the name of one of your pods.
|
where `<pod-name>` is the name of one of your pods.
|
||||||
|
|
||||||
|
|||||||
@@ -32,11 +32,11 @@ load-balanced access to an application running in a cluster.
|
|||||||
|
|
||||||
1. Run a Hello World application in your cluster:
|
1. Run a Hello World application in your cluster:
|
||||||
|
|
||||||
kubectl run hello-world --replicas=2 --labels="run=load-balancer-example" --image=gcr.io/google-samples/node-hello:1.0 --port=8080
|
kubectl run hello-world --replicas=2 --labels="run=load-balancer-example" --image=gcr.io/google-samples/node-hello:1.0 --port=8080
|
||||||
|
|
||||||
1. List the pods that are running the Hello World application:
|
1. List the pods that are running the Hello World application:
|
||||||
|
|
||||||
kubectl get pods --selector="run=load-balancer-example"
|
kubectl get pods --selector="run=load-balancer-example"
|
||||||
|
|
||||||
The output is similar to this:
|
The output is similar to this:
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ load-balanced access to an application running in a cluster.
|
|||||||
|
|
||||||
1. List the replica set for the two Hello World pods:
|
1. List the replica set for the two Hello World pods:
|
||||||
|
|
||||||
kubectl get replicasets --selector="run=load-balancer-example"
|
kubectl get replicasets --selector="run=load-balancer-example"
|
||||||
|
|
||||||
The output is similar to this:
|
The output is similar to this:
|
||||||
|
|
||||||
@@ -55,13 +55,13 @@ load-balanced access to an application running in a cluster.
|
|||||||
|
|
||||||
1. Create a Service object that exposes the replica set:
|
1. Create a Service object that exposes the replica set:
|
||||||
|
|
||||||
kubectl expose rs <your-replica-set-name> --type="LoadBalancer" --name="example-service"
|
kubectl expose rs <your-replica-set-name> --type="LoadBalancer" --name="example-service"
|
||||||
|
|
||||||
where `<your-replica-set-name>` is the name of your replica set.
|
where `<your-replica-set-name>` is the name of your replica set.
|
||||||
|
|
||||||
1. Display the IP addresses for your service:
|
1. Display the IP addresses for your service:
|
||||||
|
|
||||||
kubectl get services example-service
|
kubectl get services example-service
|
||||||
|
|
||||||
The output shows the internal IP address and the external IP address of
|
The output shows the internal IP address and the external IP address of
|
||||||
your service. If the external IP address shows as `<pending>`, repeat the
|
your service. If the external IP address shows as `<pending>`, repeat the
|
||||||
@@ -86,8 +86,8 @@ load-balanced access to an application running in a cluster.
|
|||||||
|
|
||||||
Note: If you are using Minikube, enter these commands:
|
Note: If you are using Minikube, enter these commands:
|
||||||
|
|
||||||
kubectl cluster-info
|
kubectl cluster-info
|
||||||
kubectl describe services example-service
|
kubectl describe services example-service
|
||||||
|
|
||||||
The output displays the IP address of your Minikube node and the NodePort
|
The output displays the IP address of your Minikube node and the NodePort
|
||||||
value for your service. Then enter this command to access the Hello World
|
value for your service. Then enter this command to access the Hello World
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ for database debugging.
|
|||||||
|
|
||||||
1. Create a pod:
|
1. Create a pod:
|
||||||
|
|
||||||
kubectl create -f https://k8s.io/docs/tasks/access-application-cluster/redis-master.yaml
|
kubectl create -f https://k8s.io/docs/tasks/access-application-cluster/redis-master.yaml
|
||||||
|
|
||||||
The output of a successful command verifies that the pod was created:
|
The output of a successful command verifies that the pod was created:
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ for database debugging.
|
|||||||
|
|
||||||
1. Check to see whether the pod is running and ready:
|
1. Check to see whether the pod is running and ready:
|
||||||
|
|
||||||
kubectl get pods
|
kubectl get pods
|
||||||
|
|
||||||
When the pod is ready, the output displays a STATUS of Running:
|
When the pod is ready, the output displays a STATUS of Running:
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ for database debugging.
|
|||||||
1. Verify that the Redis server is running in the pod and listening on port 6379:
|
1. Verify that the Redis server is running in the pod and listening on port 6379:
|
||||||
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
kubectl get pods redis-master --template='{{(index (index .spec.containers 0).ports 0).containerPort}}{{"\n"}}'
|
kubectl get pods redis-master --template='{{(index (index .spec.containers 0).ports 0).containerPort}}{{"\n"}}'
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
|
|
||||||
The output displays the port:
|
The output displays the port:
|
||||||
@@ -55,7 +55,7 @@ for database debugging.
|
|||||||
|
|
||||||
1. Forward port 6379 on the local workstation to port 6379 of redis-master pod:
|
1. Forward port 6379 on the local workstation to port 6379 of redis-master pod:
|
||||||
|
|
||||||
kubectl port-forward redis-master 6379:6379
|
kubectl port-forward redis-master 6379:6379
|
||||||
|
|
||||||
The output is similar to this:
|
The output is similar to this:
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ provides load balancing for an application that has two running instances.
|
|||||||
|
|
||||||
1. Run a Hello World application in your cluster:
|
1. Run a Hello World application in your cluster:
|
||||||
|
|
||||||
kubectl run hello-world --replicas=2 --labels="run=load-balancer-example" --image=gcr.io/google-samples/node-hello:1.0 --port=8080
|
kubectl run hello-world --replicas=2 --labels="run=load-balancer-example" --image=gcr.io/google-samples/node-hello:1.0 --port=8080
|
||||||
|
|
||||||
The preceding command creates a
|
The preceding command creates a
|
||||||
[Deployment](/docs/concepts/workloads/controllers/deployment/)
|
[Deployment](/docs/concepts/workloads/controllers/deployment/)
|
||||||
@@ -45,21 +45,21 @@ provides load balancing for an application that has two running instances.
|
|||||||
|
|
||||||
1. Display information about the Deployment:
|
1. Display information about the Deployment:
|
||||||
|
|
||||||
kubectl get deployments hello-world
|
kubectl get deployments hello-world
|
||||||
kubectl describe deployments hello-world
|
kubectl describe deployments hello-world
|
||||||
|
|
||||||
1. Display information about your ReplicaSet objects:
|
1. Display information about your ReplicaSet objects:
|
||||||
|
|
||||||
kubectl get replicasets
|
kubectl get replicasets
|
||||||
kubectl describe replicasets
|
kubectl describe replicasets
|
||||||
|
|
||||||
1. Create a Service object that exposes the deployment:
|
1. Create a Service object that exposes the deployment:
|
||||||
|
|
||||||
kubectl expose deployment hello-world --type=NodePort --name=example-service
|
kubectl expose deployment hello-world --type=NodePort --name=example-service
|
||||||
|
|
||||||
1. Display information about the Service:
|
1. Display information about the Service:
|
||||||
|
|
||||||
kubectl describe services example-service
|
kubectl describe services example-service
|
||||||
|
|
||||||
The output is similar to this:
|
The output is similar to this:
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ provides load balancing for an application that has two running instances.
|
|||||||
|
|
||||||
1. List the pods that are running the Hello World application:
|
1. List the pods that are running the Hello World application:
|
||||||
|
|
||||||
kubectl get pods --selector="run=load-balancer-example" --output=wide
|
kubectl get pods --selector="run=load-balancer-example" --output=wide
|
||||||
|
|
||||||
The output is similar to this:
|
The output is similar to this:
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ This page shows how to use an HTTP proxy to access the Kubernetes API.
|
|||||||
* If you do not already have an application running in your cluster, start
|
* If you do not already have an application running in your cluster, start
|
||||||
a Hello world application by entering this command:
|
a Hello world application by entering this command:
|
||||||
|
|
||||||
kubectl run node-hello --image=gcr.io/google-samples/node-hello:1.0 --port=8080
|
kubectl run node-hello --image=gcr.io/google-samples/node-hello:1.0 --port=8080
|
||||||
|
|
||||||
{% endcapture %}
|
{% endcapture %}
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ for details about addon manager and how to disable individual addons.
|
|||||||
|
|
||||||
1. List the StorageClasses in your cluster:
|
1. List the StorageClasses in your cluster:
|
||||||
|
|
||||||
kubectl get storageclass
|
kubectl get storageclass
|
||||||
|
|
||||||
The output is similar to this:
|
The output is similar to this:
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ for details about addon manager and how to disable individual addons.
|
|||||||
|
|
||||||
To mark a StorageClass as non-default, you need to change its value to `false`:
|
To mark a StorageClass as non-default, you need to change its value to `false`:
|
||||||
|
|
||||||
kubectl patch storageclass <your-class-name> -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'
|
kubectl patch storageclass <your-class-name> -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'
|
||||||
|
|
||||||
where `<your-class-name>` is the name of your chosen StorageClass.
|
where `<your-class-name>` is the name of your chosen StorageClass.
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ for details about addon manager and how to disable individual addons.
|
|||||||
Similarly to the previous step, you need to add/set the annotation
|
Similarly to the previous step, you need to add/set the annotation
|
||||||
`storageclass.kubernetes.io/is-default-class=true`.
|
`storageclass.kubernetes.io/is-default-class=true`.
|
||||||
|
|
||||||
kubectl patch storageclass <your-class-name> -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
|
kubectl patch storageclass <your-class-name> -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
|
||||||
|
|
||||||
Please note that at most one StorageClass can be marked as default. If two
|
Please note that at most one StorageClass can be marked as default. If two
|
||||||
or more of them are marked as default, Kubernetes ignores the annotation,
|
or more of them are marked as default, Kubernetes ignores the annotation,
|
||||||
@@ -73,7 +73,7 @@ for details about addon manager and how to disable individual addons.
|
|||||||
|
|
||||||
1. Verify that your chosen StorageClass is default:
|
1. Verify that your chosen StorageClass is default:
|
||||||
|
|
||||||
kubectl get storageclass
|
kubectl get storageclass
|
||||||
|
|
||||||
The output is similar to this:
|
The output is similar to this:
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ the corresponding `PersistentVolume` is not be deleted. Instead, it is moved to
|
|||||||
|
|
||||||
1. List the PersistentVolumes in your cluster:
|
1. List the PersistentVolumes in your cluster:
|
||||||
|
|
||||||
kubectl get pv
|
kubectl get pv
|
||||||
|
|
||||||
The output is similar to this:
|
The output is similar to this:
|
||||||
|
|
||||||
@@ -45,13 +45,13 @@ the corresponding `PersistentVolume` is not be deleted. Instead, it is moved to
|
|||||||
|
|
||||||
1. Chose one of your PersistentVolumes and change its reclaim policy:
|
1. Chose one of your PersistentVolumes and change its reclaim policy:
|
||||||
|
|
||||||
kubectl patch pv <your-pv-name> -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}'
|
kubectl patch pv <your-pv-name> -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}'
|
||||||
|
|
||||||
where `<your-pv-name>` is the name of your chosen PersistentVolume.
|
where `<your-pv-name>` is the name of your chosen PersistentVolume.
|
||||||
|
|
||||||
1. Verify that your chosen PersistentVolume has the right policy:
|
1. Verify that your chosen PersistentVolume has the right policy:
|
||||||
|
|
||||||
kubectl get pv
|
kubectl get pv
|
||||||
|
|
||||||
The output is similar to this:
|
The output is similar to this:
|
||||||
|
|
||||||
|
|||||||
@@ -45,11 +45,11 @@ for the `Pod`:
|
|||||||
|
|
||||||
1. Create a Pod based on the YAML configuration file:
|
1. Create a Pod based on the YAML configuration file:
|
||||||
|
|
||||||
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/cpu-ram.yaml
|
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/cpu-ram.yaml
|
||||||
|
|
||||||
1. Display information about the pod:
|
1. Display information about the pod:
|
||||||
|
|
||||||
kubectl describe pod cpu-ram-demo
|
kubectl describe pod cpu-ram-demo
|
||||||
|
|
||||||
The output is similar to this:
|
The output is similar to this:
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ Kubernetes cluster.
|
|||||||
|
|
||||||
1. List the nodes in your cluster:
|
1. List the nodes in your cluster:
|
||||||
|
|
||||||
kubectl get nodes
|
kubectl get nodes
|
||||||
|
|
||||||
The output is similar to this:
|
The output is similar to this:
|
||||||
|
|
||||||
@@ -30,13 +30,13 @@ Kubernetes cluster.
|
|||||||
|
|
||||||
1. Chose one of your nodes, and add a label to it:
|
1. Chose one of your nodes, and add a label to it:
|
||||||
|
|
||||||
kubectl label nodes <your-node-name> disktype=ssd
|
kubectl label nodes <your-node-name> disktype=ssd
|
||||||
|
|
||||||
where `<your-node-name>` is the name of your chosen node.
|
where `<your-node-name>` is the name of your chosen node.
|
||||||
|
|
||||||
1. Verify that your chosen node has a `disktype=ssd` label:
|
1. Verify that your chosen node has a `disktype=ssd` label:
|
||||||
|
|
||||||
kubectl get nodes --show-labels
|
kubectl get nodes --show-labels
|
||||||
|
|
||||||
|
|
||||||
The output is similar to this:
|
The output is similar to this:
|
||||||
@@ -60,11 +60,11 @@ a `disktype=ssd` label.
|
|||||||
1. Use the configuration file to create a pod that will get scheduled on your
|
1. Use the configuration file to create a pod that will get scheduled on your
|
||||||
chosen node:
|
chosen node:
|
||||||
|
|
||||||
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/pod.yaml
|
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/pod.yaml
|
||||||
|
|
||||||
1. Verify that the pod is running on your chosen node:
|
1. Verify that the pod is running on your chosen node:
|
||||||
|
|
||||||
kubectl get pods --output=wide
|
kubectl get pods --output=wide
|
||||||
|
|
||||||
The output is similar to this:
|
The output is similar to this:
|
||||||
|
|
||||||
|
|||||||
@@ -24,22 +24,22 @@ Here is the configuration file for the Pod:
|
|||||||
|
|
||||||
1. Create the Secrets:
|
1. Create the Secrets:
|
||||||
|
|
||||||
# Create files containing the username and password:
|
# Create files containing the username and password:
|
||||||
echo -n "admin" > ./username.txt
|
echo -n "admin" > ./username.txt
|
||||||
echo -n "1f2d1e2e67df" > ./password.txt
|
echo -n "1f2d1e2e67df" > ./password.txt
|
||||||
|
|
||||||
# Package these files into secrets:
|
# Package these files into secrets:
|
||||||
kubectl create secret generic user --from-file=./username.txt
|
kubectl create secret generic user --from-file=./username.txt
|
||||||
kubectl create secret generic pass --from-file=./password.txt
|
kubectl create secret generic pass --from-file=./password.txt
|
||||||
|
|
||||||
1. Create the Pod:
|
1. Create the Pod:
|
||||||
|
|
||||||
kubectl create -f projected-volume.yaml
|
kubectl create -f projected-volume.yaml
|
||||||
|
|
||||||
1. Verify that the Pod's Container is running, and then watch for changes to
|
1. Verify that the Pod's Container is running, and then watch for changes to
|
||||||
the Pod:
|
the Pod:
|
||||||
|
|
||||||
kubectl get --watch pod test-projected-volume
|
kubectl get --watch pod test-projected-volume
|
||||||
|
|
||||||
The output looks like this:
|
The output looks like this:
|
||||||
|
|
||||||
@@ -48,11 +48,11 @@ the Pod:
|
|||||||
|
|
||||||
1. In another terminal, get a shell to the running Container:
|
1. In another terminal, get a shell to the running Container:
|
||||||
|
|
||||||
kubectl exec -it test-projected-volume -- /bin/sh
|
kubectl exec -it test-projected-volume -- /bin/sh
|
||||||
|
|
||||||
1. In your shell, verify that the `projected-volume` directory contains your projected sources:
|
1. In your shell, verify that the `projected-volume` directory contains your projected sources:
|
||||||
|
|
||||||
/ # ls /projected-volume/
|
/ # ls /projected-volume/
|
||||||
{% endcapture %}
|
{% endcapture %}
|
||||||
|
|
||||||
{% capture whatsnext %}
|
{% capture whatsnext %}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ the [kube-apiserver][kube-apiserver]:
|
|||||||
--feature-gates=AdvancedAuditing=true
|
--feature-gates=AdvancedAuditing=true
|
||||||
```
|
```
|
||||||
|
|
||||||
`AdvancedAuditing`is customizeable in two ways. Policy, which determines what's recorded,
|
`AdvancedAuditing`is customizable in two ways. Policy, which determines what's recorded,
|
||||||
and backends, which persist records. Backend implementations include logs files and
|
and backends, which persist records. Backend implementations include logs files and
|
||||||
webhooks.
|
webhooks.
|
||||||
|
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ case you can try several things:
|
|||||||
command. Here are some example command lines that extract just the necessary
|
command. Here are some example command lines that extract just the necessary
|
||||||
information:
|
information:
|
||||||
|
|
||||||
kubectl get nodes -o yaml | grep '\sname\|cpu\|memory'
|
kubectl get nodes -o yaml | grep '\sname\|cpu\|memory'
|
||||||
kubectl get nodes -o json | jq '.items[] | {name: .metadata.name, cap: .status.capacity}'
|
kubectl get nodes -o json | jq '.items[] | {name: .metadata.name, cap: .status.capacity}'
|
||||||
|
|
||||||
The [resource quota](/docs/concepts/policy/resource-quotas/)
|
The [resource quota](/docs/concepts/policy/resource-quotas/)
|
||||||
feature can be configured to limit the total amount of
|
feature can be configured to limit the total amount of
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ the container starts.
|
|||||||
|
|
||||||
1. Create a Pod based on the YAML configuration file:
|
1. Create a Pod based on the YAML configuration file:
|
||||||
|
|
||||||
kubectl create -f https://k8s.io/docs/tasks/debug-application-cluster/termination.yaml
|
kubectl create -f https://k8s.io/docs/tasks/debug-application-cluster/termination.yaml
|
||||||
|
|
||||||
In the YAML file, in the `cmd` and `args` fields, you can see that the
|
In the YAML file, in the `cmd` and `args` fields, you can see that the
|
||||||
container sleeps for 10 seconds and then writes "Sleep expired" to
|
container sleeps for 10 seconds and then writes "Sleep expired" to
|
||||||
@@ -46,13 +46,13 @@ the container starts.
|
|||||||
|
|
||||||
1. Display information about the Pod:
|
1. Display information about the Pod:
|
||||||
|
|
||||||
kubectl get pod termination-demo
|
kubectl get pod termination-demo
|
||||||
|
|
||||||
Repeat the preceding command until the Pod is no longer running.
|
Repeat the preceding command until the Pod is no longer running.
|
||||||
|
|
||||||
1. Display detailed information about the Pod:
|
1. Display detailed information about the Pod:
|
||||||
|
|
||||||
kubectl get pod --output=yaml
|
kubectl get pod --output=yaml
|
||||||
|
|
||||||
The output includes the "Sleep expired" message:
|
The output includes the "Sleep expired" message:
|
||||||
|
|
||||||
|
|||||||
@@ -39,11 +39,11 @@ file for the Pod defines a command and two arguments:
|
|||||||
|
|
||||||
1. Create a Pod based on the YAML configuration file:
|
1. Create a Pod based on the YAML configuration file:
|
||||||
|
|
||||||
kubectl create -f https://k8s.io/docs/tasks/inject-data-application/commands.yaml
|
kubectl create -f https://k8s.io/docs/tasks/inject-data-application/commands.yaml
|
||||||
|
|
||||||
1. List the running Pods:
|
1. List the running Pods:
|
||||||
|
|
||||||
kubectl get pods
|
kubectl get pods
|
||||||
|
|
||||||
The output shows that the container that ran in the command-demo Pod has
|
The output shows that the container that ran in the command-demo Pod has
|
||||||
completed.
|
completed.
|
||||||
@@ -51,7 +51,7 @@ file for the Pod defines a command and two arguments:
|
|||||||
1. To see the output of the command that ran in the container, view the logs
|
1. To see the output of the command that ran in the container, view the logs
|
||||||
from the Pod:
|
from the Pod:
|
||||||
|
|
||||||
kubectl logs command-demo
|
kubectl logs command-demo
|
||||||
|
|
||||||
The output shows the values of the HOSTNAME and KUBERNETES_PORT environment
|
The output shows the values of the HOSTNAME and KUBERNETES_PORT environment
|
||||||
variables:
|
variables:
|
||||||
|
|||||||
@@ -34,11 +34,11 @@ Pod:
|
|||||||
|
|
||||||
1. Create a Pod based on the YAML configuration file:
|
1. Create a Pod based on the YAML configuration file:
|
||||||
|
|
||||||
kubectl create -f https://k8s.io/docs/tasks/inject-data-application/envars.yaml
|
kubectl create -f https://k8s.io/docs/tasks/inject-data-application/envars.yaml
|
||||||
|
|
||||||
1. List the running Pods:
|
1. List the running Pods:
|
||||||
|
|
||||||
kubectl get pods -l purpose=demonstrate-envars
|
kubectl get pods -l purpose=demonstrate-envars
|
||||||
|
|
||||||
The output is similar to this:
|
The output is similar to this:
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ Pod:
|
|||||||
|
|
||||||
1. Get a shell to the container running in your Pod:
|
1. Get a shell to the container running in your Pod:
|
||||||
|
|
||||||
kubectl exec -it envar-demo -- /bin/bash
|
kubectl exec -it envar-demo -- /bin/bash
|
||||||
|
|
||||||
1. In your shell, run the `printenv` command to list the environment variables.
|
1. In your shell, run the `printenv` command to list the environment variables.
|
||||||
|
|
||||||
|
|||||||
@@ -37,16 +37,16 @@ username and password:
|
|||||||
|
|
||||||
1. Create the Secret
|
1. Create the Secret
|
||||||
|
|
||||||
kubectl create -f secret.yaml
|
kubectl create -f 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:
|
||||||
|
|
||||||
kubectl create secret generic test-secret --from-literal=username='my-app' --from-literal=password='39528$vdg7Jb'
|
kubectl create secret generic test-secret --from-literal=username='my-app' --from-literal=password='39528$vdg7Jb'
|
||||||
|
|
||||||
1. View information about the Secret:
|
1. View information about the Secret:
|
||||||
|
|
||||||
kubectl get secret test-secret
|
kubectl get secret test-secret
|
||||||
|
|
||||||
Output:
|
Output:
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ username and password:
|
|||||||
|
|
||||||
1. View more detailed information about the Secret:
|
1. View more detailed information about the Secret:
|
||||||
|
|
||||||
kubectl describe secret test-secret
|
kubectl describe secret test-secret
|
||||||
|
|
||||||
Output:
|
Output:
|
||||||
|
|
||||||
@@ -80,11 +80,11 @@ 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 secret-pod.yaml
|
||||||
|
|
||||||
1. Verify that your Pod is running:
|
1. Verify that your Pod is running:
|
||||||
|
|
||||||
kubectl get pod secret-test-pod
|
kubectl get pod secret-test-pod
|
||||||
|
|
||||||
Output:
|
Output:
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ Here is a configuration file you can use to create a Pod:
|
|||||||
|
|
||||||
1. Get a shell into the Container that is running in your Pod:
|
1. Get a shell into the Container that is running in your Pod:
|
||||||
|
|
||||||
kubectl exec -it secret-test-pod -- /bin/bash
|
kubectl exec -it secret-test-pod -- /bin/bash
|
||||||
|
|
||||||
1. The secret data is exposed to the Container through a Volume mounted under
|
1. The secret data is exposed to the Container through a Volume mounted under
|
||||||
`/etc/secret-volume`. In your shell, go to the directory where the secret data
|
`/etc/secret-volume`. In your shell, go to the directory where the secret data
|
||||||
@@ -127,11 +127,11 @@ 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 secret-envars-pod.yaml
|
||||||
|
|
||||||
1. Verify that your Pod is running:
|
1. Verify that your Pod is running:
|
||||||
|
|
||||||
kubectl get pod secret-envars-test-pod
|
kubectl get pod secret-envars-test-pod
|
||||||
|
|
||||||
Output:
|
Output:
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ Here is a configuration file you can use to create a Pod:
|
|||||||
|
|
||||||
1. Get a shell into the Container that is running in your Pod:
|
1. Get a shell into the Container that is running in your Pod:
|
||||||
|
|
||||||
kubectl exec -it secret-envars-test-pod -- /bin/bash
|
kubectl exec -it secret-envars-test-pod -- /bin/bash
|
||||||
|
|
||||||
1. In your shell, display the environment variables:
|
1. In your shell, display the environment variables:
|
||||||
|
|
||||||
|
|||||||
@@ -123,18 +123,28 @@ Kubernetes 1.6 adds support for making use of custom metrics in the Horizontal P
|
|||||||
You can add custom metrics for the Horizontal Pod Autoscaler to use in the `autoscaling/v2alpha1` API.
|
You can add custom metrics for the Horizontal Pod Autoscaler to use in the `autoscaling/v2alpha1` API.
|
||||||
Kubernetes then queries the new custom metrics API to fetch the values of the appropriate custom metrics.
|
Kubernetes then queries the new custom metrics API to fetch the values of the appropriate custom metrics.
|
||||||
|
|
||||||
### Prerequisites
|
### Requirements
|
||||||
|
|
||||||
In order to use custom metrics in the Horizontal Pod Autoscaler, you must deploy your cluster with the
|
To use custom metrics with your Horizontal Pod Autoscaler, you must set the necessary configurations when deploying your cluster:
|
||||||
`--horizontal-pod-autoscaler-use-rest-clients` flag on the controller manager set to true. You must then configure
|
|
||||||
your controller manager to speak to the API server through the API server aggregator, by setting the controller
|
|
||||||
manager's target API server to the API server aggregator (using the `--apiserver` flag). The resource metrics API and
|
|
||||||
custom metrics API must also be registered with the API server aggregator, and must be served by API servers running
|
|
||||||
on the cluster.
|
|
||||||
|
|
||||||
You can use Heapster's implementation of the resource metrics API by running Heapster with the`--api-server` flag set
|
* [Enable the API aggregation layer](/docs/tasks/access-kubernetes-api/configure-aggregation-layer/) if you have not already done so.
|
||||||
to true. A separate component must provide the custom metrics API (more information on the custom metrics API is
|
|
||||||
available at [the k8s.io/metrics repository](https://github.com/kubernetes/metrics)).
|
* Register your resource metrics API and your
|
||||||
|
custom metrics API with the API aggregation layer. Both of these API servers must be running *on* your cluster.
|
||||||
|
|
||||||
|
* *Resource Metrics API*: You can use Heapster's implementation of the resource metrics API, by running Heapster with its `--api-server` flag set to true.
|
||||||
|
|
||||||
|
* *Custom Metrics API*: This must be provided by a separate component. To get started with boilerplate code, see the [kubernetes-incubator/custom-metrics-apiserver](https://github.com/kubernetes-incubator/custom-metrics-apiserver) and the [k8s.io/metrics](https://github.com/kubernetes/metrics) repositories.
|
||||||
|
|
||||||
|
* Set the appropriate flags for kube-controller-manager:
|
||||||
|
|
||||||
|
* `--horizontal-pod-autoscaler-use-rest-clients` should be true.
|
||||||
|
|
||||||
|
* `--kubeconfig <path-to-kubeconfig>` OR `--master <ip-address-of-apiserver>`
|
||||||
|
|
||||||
|
Note that either the `--master` or `--kubeconfig` flag can be used; `--master` will override `--kubeconfig` if both are specified. These flags specify the location of the API aggregation layer, allowing the controller manager to communicate to the API server.
|
||||||
|
|
||||||
|
In Kubernetes 1.7, the standard aggregation layer that Kubernetes provides runs in-process with the kube-apiserver, so the target IP address can be found with `kubectl get pods --selector k8s-app=kube-apiserver --namespace kube-system -o jsonpath='{.items[0].status.podIP}'`.
|
||||||
|
|
||||||
## Further reading
|
## Further reading
|
||||||
|
|
||||||
|
|||||||
@@ -85,11 +85,11 @@ for a secure solution.
|
|||||||
|
|
||||||
1. Deploy the contents of the YAML file:
|
1. Deploy the contents of the YAML file:
|
||||||
|
|
||||||
kubectl create -f https://k8s.io/docs/tasks/run-application/mysql-deployment.yaml
|
kubectl create -f https://k8s.io/docs/tasks/run-application/mysql-deployment.yaml
|
||||||
|
|
||||||
1. Display information about the Deployment:
|
1. Display information about the Deployment:
|
||||||
|
|
||||||
kubectl describe deployment mysql
|
kubectl describe deployment mysql
|
||||||
|
|
||||||
Name: mysql
|
Name: mysql
|
||||||
Namespace: default
|
Namespace: default
|
||||||
@@ -108,14 +108,14 @@ for a secure solution.
|
|||||||
|
|
||||||
1. List the pods created by the Deployment:
|
1. List the pods created by the Deployment:
|
||||||
|
|
||||||
kubectl get pods -l app=mysql
|
kubectl get pods -l app=mysql
|
||||||
|
|
||||||
NAME READY STATUS RESTARTS AGE
|
NAME READY STATUS RESTARTS AGE
|
||||||
mysql-63082529-2z3ki 1/1 Running 0 3m
|
mysql-63082529-2z3ki 1/1 Running 0 3m
|
||||||
|
|
||||||
1. Inspect the Persistent Volume:
|
1. Inspect the Persistent Volume:
|
||||||
|
|
||||||
kubectl describe pv mysql-pv
|
kubectl describe pv mysql-pv
|
||||||
|
|
||||||
Name: mysql-pv
|
Name: mysql-pv
|
||||||
Labels: <none>
|
Labels: <none>
|
||||||
@@ -135,7 +135,7 @@ for a secure solution.
|
|||||||
|
|
||||||
1. Inspect the PersistentVolumeClaim:
|
1. Inspect the PersistentVolumeClaim:
|
||||||
|
|
||||||
kubectl describe pvc mysql-pv-claim
|
kubectl describe pvc mysql-pv-claim
|
||||||
|
|
||||||
Name: mysql-pv-claim
|
Name: mysql-pv-claim
|
||||||
Namespace: default
|
Namespace: default
|
||||||
|
|||||||
@@ -38,11 +38,11 @@ a Deployment that runs the nginx:1.7.9 Docker image:
|
|||||||
|
|
||||||
1. Create a Deployment based on the YAML file:
|
1. Create a Deployment based on the YAML file:
|
||||||
|
|
||||||
kubectl create -f https://k8s.io/docs/tasks/run-application/deployment.yaml
|
kubectl create -f https://k8s.io/docs/tasks/run-application/deployment.yaml
|
||||||
|
|
||||||
1. Display information about the Deployment:
|
1. Display information about the Deployment:
|
||||||
|
|
||||||
kubectl describe deployment nginx-deployment
|
kubectl describe deployment nginx-deployment
|
||||||
|
|
||||||
user@computer:~/kubernetes.github.io$ kubectl describe deployment nginx-deployment
|
user@computer:~/kubernetes.github.io$ kubectl describe deployment nginx-deployment
|
||||||
Name: nginx-deployment
|
Name: nginx-deployment
|
||||||
@@ -64,7 +64,7 @@ a Deployment that runs the nginx:1.7.9 Docker image:
|
|||||||
|
|
||||||
1. List the pods created by the deployment:
|
1. List the pods created by the deployment:
|
||||||
|
|
||||||
kubectl get pods -l app=nginx
|
kubectl get pods -l app=nginx
|
||||||
|
|
||||||
NAME READY STATUS RESTARTS AGE
|
NAME READY STATUS RESTARTS AGE
|
||||||
nginx-deployment-1771418926-7o5ns 1/1 Running 0 16h
|
nginx-deployment-1771418926-7o5ns 1/1 Running 0 16h
|
||||||
@@ -72,7 +72,7 @@ a Deployment that runs the nginx:1.7.9 Docker image:
|
|||||||
|
|
||||||
1. Display information about a pod:
|
1. Display information about a pod:
|
||||||
|
|
||||||
kubectl describe pod <pod-name>
|
kubectl describe pod <pod-name>
|
||||||
|
|
||||||
where `<pod-name>` is the name of one of your pods.
|
where `<pod-name>` is the name of one of your pods.
|
||||||
|
|
||||||
@@ -85,11 +85,11 @@ specifies that the deployment should be updated to use nginx 1.8.
|
|||||||
|
|
||||||
1. Apply the new YAML file:
|
1. Apply the new YAML file:
|
||||||
|
|
||||||
kubectl apply -f https://k8s.io/docs/tutorials/stateless-application/deployment-update.yaml
|
kubectl apply -f https://k8s.io/docs/tutorials/stateless-application/deployment-update.yaml
|
||||||
|
|
||||||
1. Watch the deployment create pods with new names and delete the old pods:
|
1. Watch the deployment create pods with new names and delete the old pods:
|
||||||
|
|
||||||
kubectl get pods -l app=nginx
|
kubectl get pods -l app=nginx
|
||||||
|
|
||||||
## Scaling the application by increasing the replica count
|
## Scaling the application by increasing the replica count
|
||||||
|
|
||||||
@@ -101,11 +101,11 @@ should have four pods:
|
|||||||
|
|
||||||
1. Apply the new YAML file:
|
1. Apply the new YAML file:
|
||||||
|
|
||||||
kubectl apply -f https://k8s.io/docs/tutorials/stateless-application/deployment-scale.yaml
|
kubectl apply -f https://k8s.io/docs/tutorials/stateless-application/deployment-scale.yaml
|
||||||
|
|
||||||
1. Verify that the Deployment has four pods:
|
1. Verify that the Deployment has four pods:
|
||||||
|
|
||||||
kubectl get pods -l app=nginx
|
kubectl get pods -l app=nginx
|
||||||
|
|
||||||
The output is similar to this:
|
The output is similar to this:
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -894,7 +894,7 @@ configuration involves several manual steps:
|
|||||||
|
|
||||||
1. Export the live object to a local configuration file:
|
1. Export the live object to a local configuration file:
|
||||||
|
|
||||||
kubectl get <kind>/<name> -o yaml --export > <kind>_<name>.yaml
|
kubectl get <kind>/<name> -o yaml --export > <kind>_<name>.yaml
|
||||||
|
|
||||||
1. Manually remove the `status` field from the configuration file.
|
1. Manually remove the `status` field from the configuration file.
|
||||||
|
|
||||||
@@ -903,7 +903,7 @@ configuration involves several manual steps:
|
|||||||
|
|
||||||
1. Set the `kubectl.kubernetes.io/last-applied-configuration` annotation on the object:
|
1. Set the `kubectl.kubernetes.io/last-applied-configuration` annotation on the object:
|
||||||
|
|
||||||
kubectl replace --save-config -f <kind>_<name>.yaml
|
kubectl replace --save-config -f <kind>_<name>.yaml
|
||||||
|
|
||||||
1. Change processes to use `kubectl apply` for managing the object exclusively.
|
1. Change processes to use `kubectl apply` for managing the object exclusively.
|
||||||
|
|
||||||
@@ -915,7 +915,7 @@ TODO(pwittrock): Why doesn't export remove the status field? Seems like it shou
|
|||||||
|
|
||||||
1. Set the `kubectl.kubernetes.io/last-applied-configuration` annotation on the object:
|
1. Set the `kubectl.kubernetes.io/last-applied-configuration` annotation on the object:
|
||||||
|
|
||||||
kubectl replace --save-config -f <kind>_<name>.yaml
|
kubectl replace --save-config -f <kind>_<name>.yaml
|
||||||
|
|
||||||
1. Change processes to use `kubectl apply` for managing the object exclusively.
|
1. Change processes to use `kubectl apply` for managing the object exclusively.
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -97,13 +97,13 @@ several manual steps.
|
|||||||
|
|
||||||
1. Export the live object to a local object configuration file:
|
1. Export the live object to a local object configuration file:
|
||||||
|
|
||||||
kubectl get <kind>/<name> -o yaml --export > <kind>_<name>.yaml
|
kubectl get <kind>/<name> -o yaml --export > <kind>_<name>.yaml
|
||||||
|
|
||||||
1. Manually remove the status field from the object configuration file.
|
1. Manually remove the status field from the object configuration file.
|
||||||
|
|
||||||
1. For subsequent object management, use `replace` exclusively.
|
1. For subsequent object management, use `replace` exclusively.
|
||||||
|
|
||||||
kubectl replace -f <kind>_<name>.yaml
|
kubectl replace -f <kind>_<name>.yaml
|
||||||
|
|
||||||
|
|
||||||
## Defining controller selectors and PodTemplate labels
|
## Defining controller selectors and PodTemplate labels
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ external IP address.
|
|||||||
|
|
||||||
1. Run a Hello World application in your cluster:
|
1. Run a Hello World application in your cluster:
|
||||||
|
|
||||||
kubectl run hello-world --replicas=5 --labels="run=load-balancer-example" --image=gcr.io/google-samples/node-hello:1.0 --port=8080
|
kubectl run hello-world --replicas=5 --labels="run=load-balancer-example" --image=gcr.io/google-samples/node-hello:1.0 --port=8080
|
||||||
|
|
||||||
The preceding command creates a
|
The preceding command creates a
|
||||||
[Deployment](/docs/concepts/workloads/controllers/deployment/)
|
[Deployment](/docs/concepts/workloads/controllers/deployment/)
|
||||||
@@ -52,21 +52,21 @@ external IP address.
|
|||||||
|
|
||||||
1. Display information about the Deployment:
|
1. Display information about the Deployment:
|
||||||
|
|
||||||
kubectl get deployments hello-world
|
kubectl get deployments hello-world
|
||||||
kubectl describe deployments hello-world
|
kubectl describe deployments hello-world
|
||||||
|
|
||||||
1. Display information about your ReplicaSet objects:
|
1. Display information about your ReplicaSet objects:
|
||||||
|
|
||||||
kubectl get replicasets
|
kubectl get replicasets
|
||||||
kubectl describe replicasets
|
kubectl describe replicasets
|
||||||
|
|
||||||
1. Create a Service object that exposes the deployment:
|
1. Create a Service object that exposes the deployment:
|
||||||
|
|
||||||
kubectl expose deployment hello-world --type=LoadBalancer --name=my-service
|
kubectl expose deployment hello-world --type=LoadBalancer --name=my-service
|
||||||
|
|
||||||
1. Display information about the Service:
|
1. Display information about the Service:
|
||||||
|
|
||||||
kubectl get services my-service
|
kubectl get services my-service
|
||||||
|
|
||||||
The output is similar to this:
|
The output is similar to this:
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ external IP address.
|
|||||||
|
|
||||||
1. Display detailed information about the Service:
|
1. Display detailed information about the Service:
|
||||||
|
|
||||||
kubectl describe services my-service
|
kubectl describe services my-service
|
||||||
|
|
||||||
The output is similar to this:
|
The output is similar to this:
|
||||||
|
|
||||||
@@ -104,13 +104,13 @@ external IP address.
|
|||||||
addresses of the pods that are running the Hello World application. To
|
addresses of the pods that are running the Hello World application. To
|
||||||
verify these are pod addresses, enter this command:
|
verify these are pod addresses, enter this command:
|
||||||
|
|
||||||
kubectl get pods --output=wide
|
kubectl get pods --output=wide
|
||||||
|
|
||||||
The output is similar to this:
|
The output is similar to this:
|
||||||
|
|
||||||
NAME ... IP NODE
|
NAME ... IP NODE
|
||||||
hello-world-2895499144-1jaz9 ... 10.0.1.6 gke-cluster-1-default-pool-e0b8d269-1afc
|
hello-world-2895499144-1jaz9 ... 10.0.1.6 gke-cluster-1-default-pool-e0b8d269-1afc
|
||||||
hello-world-2895499144-2e5uh ... 0.0.1.8 gke-cluster-1-default-pool-e0b8d269-1afc
|
hello-world-2895499144-2e5uh ... 10.0.1.8 gke-cluster-1-default-pool-e0b8d269-1afc
|
||||||
hello-world-2895499144-9m4h1 ... 10.0.0.6 gke-cluster-1-default-pool-e0b8d269-5v7a
|
hello-world-2895499144-9m4h1 ... 10.0.0.6 gke-cluster-1-default-pool-e0b8d269-5v7a
|
||||||
hello-world-2895499144-o4z13 ... 10.0.1.7 gke-cluster-1-default-pool-e0b8d269-1afc
|
hello-world-2895499144-o4z13 ... 10.0.1.7 gke-cluster-1-default-pool-e0b8d269-1afc
|
||||||
hello-world-2895499144-segjf ... 10.0.2.5 gke-cluster-1-default-pool-e0b8d269-cpuc
|
hello-world-2895499144-segjf ... 10.0.2.5 gke-cluster-1-default-pool-e0b8d269-cpuc
|
||||||
|
|||||||
Reference in New Issue
Block a user