`describe` | `kubectl describe (-f FILENAME | TYPE [NAME_PREFIX | /NAME | -l label]) [flags]` | Display the detailed state of one or more resources.
`describe` | `kubectl describe (-f FILENAME | TYPE [NAME_PREFIX | /NAME | -l label]) [flags]` | Display the detailed state of one or more resources.
`edit` | `kubectl edit (-f FILENAME | TYPE NAME | TYPE/NAME) [flags]` | Edit and update the definition of one or more resources on the server by using the default editor.
`edit` | `kubectl edit (-f FILENAME | TYPE NAME | TYPE/NAME) [flags]` | Edit and update the definition of one or more resources on the server by using the default editor.
`exec` | `kubectl exec POD [-c CONTAINER] [-i] [-t] [flags] [-- COMMAND [args...]]` | Execute a command against a container in a pod.
`exec` | `kubectl exec POD [-c CONTAINER] [-i] [-t] [flags] [-- COMMAND [args...]]` | Execute a command against a container in a pod.
`expose` | `kubectl expose (-f FILENAME | TYPE NAME | TYPE/NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [----external-ip=external-ip-of-service] [--type=type] [flags]` | Expose a replication controller, service, or pod as a new Kubernetes service.
`expose` | `kubectl expose (-f FILENAME | TYPE NAME | TYPE/NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [----external-ip=external-ip-of-service] [--type=type] [flags]` | Expose a replication controller, service, deployment or pod as a new Kubernetes service.
`get` | `kubectl get (-f FILENAME | TYPE [NAME | /NAME | -l label]) [--watch] [--sort-by=FIELD] [[-o | --output]=OUTPUT_FORMAT] [flags]` | List one or more resources.
`get` | `kubectl get (-f FILENAME | TYPE [NAME | /NAME | -l label]) [--watch] [--sort-by=FIELD] [[-o | --output]=OUTPUT_FORMAT] [flags]` | List one or more resources.
`label` | `kubectl label (-f FILENAME | TYPE NAME | TYPE/NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--overwrite] [--all] [--resource-version=version] [flags]` | Add or update the labels of one or more resources.
`label` | `kubectl label (-f FILENAME | TYPE NAME | TYPE/NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--overwrite] [--all] [--resource-version=version] [flags]` | Add or update the labels of one or more resources.
`logs` | `kubectl logs POD [-c CONTAINER] [--follow] [flags]` | Print the logs for a container in a pod.
`logs` | `kubectl logs POD [-c CONTAINER] [--follow] [flags]` | Print the logs for a container in a pod.
@@ -42,7 +42,7 @@ to Kubernetes and running your first containers on the cluster.
...
@@ -42,7 +42,7 @@ to Kubernetes and running your first containers on the cluster.
From this point onwards, it is assumed that `kubectl` is on your path from one of the getting started guides.
From this point onwards, it is assumed that `kubectl` is on your path from one of the getting started guides.
The [`kubectl run`](../docs/user-guide/kubectl/kubectl_run.md) line below will create two [nginx](https://registry.hub.docker.com/_/nginx/)[pods](../docs/user-guide/pods.md) listening on port 80. It will also create a [replication controller](../docs/user-guide/replication-controller.md) named `my-nginx` to ensure that there are always two pods running.
The [`kubectl run`](../docs/user-guide/kubectl/kubectl_run.md) line below will create two [nginx](https://registry.hub.docker.com/_/nginx/)[pods](../docs/user-guide/pods.md) listening on port 80. It will also create a [deployment](../docs/user-guide/deployments.md) named `my-nginx` to ensure that there are always two pods running.
```bash
```bash
kubectl run my-nginx --image=nginx --replicas=2 --port=80
kubectl run my-nginx --image=nginx --replicas=2 --port=80
...
@@ -54,16 +54,10 @@ Once the pods are created, you can list them to see what is up and running:
...
@@ -54,16 +54,10 @@ Once the pods are created, you can list them to see what is up and running:
kubectl get pods
kubectl get pods
```
```
You can also see the replication controller that was created:
You can also see the deployment that was created:
```bash
```bash
kubectl get rc
kubectl get deployment
```
To delete the two replicated containers, delete the replication controller:
```bash
kubectl delete rc my-nginx
```
```
### Exposing your pods to the internet.
### Exposing your pods to the internet.
...
@@ -72,7 +66,7 @@ On some platforms (for example Google Compute Engine) the kubectl command can in
...
@@ -72,7 +66,7 @@ On some platforms (for example Google Compute Engine) the kubectl command can in
This should print the service that has been created, and map an external IP address to the service. Where to find this external IP address will depend on the environment you run in. For instance, for Google Compute Engine the external IP address is listed as part of the newly created service and can be retrieved by running
This should print the service that has been created, and map an external IP address to the service. Where to find this external IP address will depend on the environment you run in. For instance, for Google Compute Engine the external IP address is listed as part of the newly created service and can be retrieved by running
...
@@ -83,6 +77,14 @@ kubectl get services
...
@@ -83,6 +77,14 @@ kubectl get services
In order to access your nginx landing page, you also have to make sure that traffic from external IPs is allowed. Do this by opening a firewall to allow traffic on port 80.
In order to access your nginx landing page, you also have to make sure that traffic from external IPs is allowed. Do this by opening a firewall to allow traffic on port 80.
### Cleanup
To delete the two replicated containers, delete the deployment:
```bash
kubectl delete deployment my-nginx
```
### Next: Configuration files
### Next: Configuration files
Most people will eventually want to use declarative configuration files for creating/modifying their applications. A [simplified introduction](../docs/user-guide/deploying-applications.md)
Most people will eventually want to use declarative configuration files for creating/modifying their applications. A [simplified introduction](../docs/user-guide/deploying-applications.md)