2015-07-12 04:04:52 +00:00
<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->
<!-- BEGIN STRIP_FOR_RELEASE -->
2015-07-16 17:02:26 +00:00
< img src = "http://kubernetes.io/img/warning.png" alt = "WARNING"
width="25" height="25">
< img src = "http://kubernetes.io/img/warning.png" alt = "WARNING"
width="25" height="25">
< img src = "http://kubernetes.io/img/warning.png" alt = "WARNING"
width="25" height="25">
< img src = "http://kubernetes.io/img/warning.png" alt = "WARNING"
width="25" height="25">
< img src = "http://kubernetes.io/img/warning.png" alt = "WARNING"
width="25" height="25">
< h2 > PLEASE NOTE: This document applies to the HEAD of the source tree< / h2 >
If you are using a released version of Kubernetes, you should
refer to the docs that go with that version.
< strong >
2015-11-03 18:17:57 +00:00
The latest release of this document can be found
[here ](http://releases.k8s.io/release-1.1/docs/user-guide/quick-start.md ).
2015-07-16 17:02:26 +00:00
Documentation for other releases can be found at
[releases.k8s.io ](http://releases.k8s.io ).
< / strong >
--
2015-07-13 22:15:35 +00:00
2015-07-12 04:04:52 +00:00
<!-- END STRIP_FOR_RELEASE -->
<!-- END MUNGE: UNVERSIONED_WARNING -->
2015-07-17 22:35:41 +00:00
2015-07-10 18:22:56 +00:00
# Kubernetes User Guide: Managing Applications: Quick start
2015-07-14 06:40:25 +00:00
**Table of Contents**
<!-- BEGIN MUNGE: GENERATED_TOC -->
2015-07-17 16:20:19 +00:00
2015-07-17 00:56:56 +00:00
- [Kubernetes User Guide: Managing Applications: Quick start ](#kubernetes-user-guide-managing-applications-quick-start )
2015-07-14 06:40:25 +00:00
- [Launching a simple application ](#launching-a-simple-application )
- [Exposing your application to the Internet ](#exposing-your-application-to-the-internet )
- [Killing the application ](#killing-the-application )
2015-07-15 18:26:51 +00:00
- [What's next? ](#whats-next )
2015-07-14 06:40:25 +00:00
<!-- END MUNGE: GENERATED_TOC -->
2015-07-14 22:27:01 +00:00
This guide will help you get oriented to Kubernetes and running your first containers on the cluster. If you are already familiar with the docker-cli, you can also checkout the docker-cli to kubectl migration guide [here ](docker-cli-to-kubectl.md ).
2015-07-10 18:22:56 +00:00
## Launching a simple application
Once your application is packaged into a container and pushed to an image registry, you’ re ready to deploy it to Kubernetes.
2015-07-14 00:13:09 +00:00
For example, [nginx ](http://wiki.nginx.org/Main ) is a popular HTTP server, with a [pre-built container on Docker hub ](https://registry.hub.docker.com/_/nginx/ ). The [`kubectl run` ](kubectl/kubectl_run.md ) command below will create two nginx replicas, listening on port 80.
2015-07-10 18:22:56 +00:00
2015-07-19 00:18:40 +00:00
```console
2015-07-10 18:22:56 +00:00
$ kubectl run my-nginx --image=nginx --replicas=2 --port=80
CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS
my-nginx my-nginx nginx run=my-nginx 2
```
You can see that they are running by:
2015-07-17 02:01:02 +00:00
2015-07-19 00:18:40 +00:00
```console
2015-07-10 18:22:56 +00:00
$ kubectl get po
NAME READY STATUS RESTARTS AGE
my-nginx-l8n3i 1/1 Running 0 29m
my-nginx-q7jo3 1/1 Running 0 29m
```
Kubernetes will ensure that your application keeps running, by automatically restarting containers that fail, spreading containers across nodes, and recreating containers on new nodes when nodes fail.
2015-07-17 22:35:41 +00:00
2015-07-10 18:22:56 +00:00
## Exposing your application to the Internet
2015-07-17 22:35:41 +00:00
2015-07-10 18:22:56 +00:00
Through integration with some cloud providers (for example Google Compute Engine and AWS EC2), Kubernetes enables you to request that it provision a public IP address for your application. To do this run:
2015-07-19 00:18:40 +00:00
```console
2015-07-10 18:22:56 +00:00
$ kubectl expose rc my-nginx --port=80 --type=LoadBalancer
2015-10-27 00:47:18 +00:00
service "my-nginx" exposed
2015-07-10 18:22:56 +00:00
```
To find the public IP address assigned to your application, execute:
2015-07-19 00:18:40 +00:00
```console
2015-08-08 04:08:43 +00:00
$ kubectl get svc my-nginx
NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE
my-nginx 10.179.240.1 25.1.2.3 80/TCP run=nginx 8d
2015-07-10 18:22:56 +00:00
```
2015-08-08 04:08:43 +00:00
You may need to wait for a minute or two for the external ip address to be provisioned.
2015-07-16 09:03:32 +00:00
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 ](services-firewalls.md ).
2015-07-10 18:22:56 +00:00
## Killing the application
To kill the application and delete its containers and public IP address, do:
2015-07-19 00:18:40 +00:00
```console
2015-07-10 18:22:56 +00:00
$ kubectl delete rc my-nginx
replicationcontrollers/my-nginx
$ kubectl delete svc my-nginx
services/my-nginx
```
2015-07-14 06:40:25 +00:00
## What's next?
[Learn about how to configure common container parameters, such as commands and environment variables. ](configuring-containers.md )
2015-07-10 18:22:56 +00:00
2015-07-14 00:13:09 +00:00
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
2015-07-10 18:22:56 +00:00
[![Analytics ](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/quick-start.md?pixel )]()
2015-07-14 00:13:09 +00:00
<!-- END MUNGE: GENERATED_ANALYTICS -->