Note that we omit the labels and the selector fields of the replication controller, because they will be populated from the labels field of the pod template by default.
Note that we omit the labels and the selector fields of the replication controller, because they will be populated from the labels field of the pod template by default.
```
```
kubectl create -f controller.yaml
kubectl create -f ./controller.yaml
```
```
This will spin up 24 instances of the test. They will run to completion, then exit, and the kubelet will restart them, accumulating more and more runs of the test.
This will spin up 24 instances of the test. They will run to completion, then exit, and the kubelet will restart them, accumulating more and more runs of the test.
Send the pod description to Kubernetes using the `kubectl` CLI:
Send the pod description to Kubernetes using the `kubectl` CLI:
```bash
```bash
$ kubectl create -f nginx.yaml
$ kubectl create -f./nginx.yaml
pods/nginx
pods/nginx
```
```
...
@@ -256,8 +256,8 @@ sed -e "s/{{ pillar\['dns_server'\] }}/10.10.10.10/g" \
...
@@ -256,8 +256,8 @@ sed -e "s/{{ pillar\['dns_server'\] }}/10.10.10.10/g" \
Now the kube-dns pod and service are ready to be launched:
Now the kube-dns pod and service are ready to be launched:
```bash
```bash
kubectl create -f skydns-rc.yaml
kubectl create -f./skydns-rc.yaml
kubectl create -f skydns-svc.yaml
kubectl create -f./skydns-svc.yaml
```
```
Check with `kubectl get pods --namespace=kube-system` that 3/3 containers of the pods are eventually up and running. Note that the kube-dns pods run in the `kube-system` namespace, not in `default`.
Check with `kubectl get pods --namespace=kube-system` that 3/3 containers of the pods are eventually up and running. Note that the kube-dns pods run in the `kube-system` namespace, not in `default`.
...
@@ -286,7 +286,7 @@ EOF
...
@@ -286,7 +286,7 @@ EOF
Then start the pod:
Then start the pod:
```bash
```bash
kubectl create -f busybox.yaml
kubectl create -f./busybox.yaml
```
```
When the pod is up and running, start a lookup for the Kubernetes master service, made available on 10.10.10.1 by default:
When the pod is up and running, start a lookup for the Kubernetes master service, made available on 10.10.10.1 by default:
And a directory can be specified rather than or in addition to individual files:
And a directory can be specified rather than or in addition to individual files:
```bash
```bash
$ kubectl create -f nginx/
$ kubectl create -f./nginx/
```
```
`kubectl` will read any files with suffixes `.yaml`, `.yml`, or `.json`.
`kubectl` will read any files with suffixes `.yaml`, `.yml`, or `.json`.
...
@@ -107,7 +107,7 @@ replicationcontrollers/nginx
...
@@ -107,7 +107,7 @@ replicationcontrollers/nginx
Resource creation isn’t the only operation that `kubectl` can perform in bulk. It can also extract resource names from configuration files in order to perform other operations, in particular to delete the same resources you created:
Resource creation isn’t the only operation that `kubectl` can perform in bulk. It can also extract resource names from configuration files in order to perform other operations, in particular to delete the same resources you created:
```bash
```bash
$ kubectl delete -f nginx/
$ kubectl delete -f./nginx/
replicationcontrollers/my-nginx
replicationcontrollers/my-nginx
services/my-nginx-svc
services/my-nginx-svc
```
```
...
@@ -126,7 +126,7 @@ services/my-nginx-svc
...
@@ -126,7 +126,7 @@ services/my-nginx-svc
Because `kubectl` outputs resource names in the same syntax it accepts, it’s easy to chain operations using `$()` or `xargs`:
Because `kubectl` outputs resource names in the same syntax it accepts, it’s easy to chain operations using `$()` or `xargs`:
```bash
```bash
$ kubectl get $(kubectl create -f nginx/ | grep my-nginx)
$ kubectl get $(kubectl create -f./nginx/ | grep my-nginx)
@@ -380,10 +380,9 @@ The patch is specified using json.
...
@@ -380,10 +380,9 @@ The patch is specified using json.
For more significant changes, you can `get` the resource, edit it, and then `replace` the resource with the updated version:
For more significant changes, you can `get` the resource, edit it, and then `replace` the resource with the updated version:
```bash
```bash
$ export TMP=/tmp/nginx.yaml
$ kubectl get rc my-nginx-v4 -o yaml > /tmp/nginx.yaml
$ kubectl get rc my-nginx-v4 -o yaml >$TMP
$ vi /tmp/nginx.yaml
$ emacs $TMP
$ kubectl replace -f /tmp/nginx.yaml
$ kubectl replace -f$TMP
replicationcontrollers/my-nginx-v4
replicationcontrollers/my-nginx-v4
$ rm$TMP
$ rm$TMP
```
```
...
@@ -392,7 +391,7 @@ The system ensures that you don’t clobber changes made by other users or compo
...
@@ -392,7 +391,7 @@ The system ensures that you don’t clobber changes made by other users or compo
In some cases, you may need to update resource fields that cannot be updated once initialized, or you may just want to make a recursive change immediately, such as to fix broken pods created by a replication controller. To change such fields, use `replace --force`, which deletes and re-creates the resource. In this case, you can simply modify your original configuration file:
In some cases, you may need to update resource fields that cannot be updated once initialized, or you may just want to make a recursive change immediately, such as to fix broken pods created by a replication controller. To change such fields, use `replace --force`, which deletes and re-creates the resource. In this case, you can simply modify your original configuration file:
Change to the `<kubernetes>/examples/guestbook` directory if you're not already there. Create the redis master pod in your Kubernetes cluster by running:
Change to the `<kubernetes>/examples/guestbook` directory if you're not already there. Create the redis master pod in your Kubernetes cluster by running:
@@ -122,7 +122,7 @@ Note that we've defined a volume mount for `/var/lib/mysql`, and specified a vol
...
@@ -122,7 +122,7 @@ Note that we've defined a volume mount for `/var/lib/mysql`, and specified a vol
Once you've edited the file to set your database password, create the pod as follows, where `<kubernetes>` is the path to your Kubernetes installation:
Once you've edited the file to set your database password, create the pod as follows, where `<kubernetes>` is the path to your Kubernetes installation: