In this guide, you’ll learn how to get started with Rancher v2.0, including:
We’ll also cover a couple of advanced topics, such as:
To begin, you’ll need to install a supported version of Docker on a single Linux host:
It only takes one command and a few minutes to install and launch Rancher Server. Once installed, you can open a web browser to access the Rancher UI.
Run this Docker command on your host:
$ sudo docker run -d --restart=unless-stopped -p 8080:8080 rancher/server:preview
This process might take several minutes to complete.
To access the Rancher UI, go to
<SERVER_IP> with the IP address of your host. Rancher automatically deploys and manages Kubernetes, and the UI displays a Welcome page with two options for adding hosts.
Note: Initially, Rancher creates a Default cluster and environment for you. Rancher supports grouping resources into multiples clusters and environments. A cluster is a group of physical (or virtual) compute resources. Each environment is tied to one cluster and runs its containers on the cluster’s hosts, and you can share a cluster with more than one environment. An environment is a namespace where applications, services, and containers are defined. The containers in an environment can communicate with each other over a shared managed network, and you can give different users/groups access to manage the resources of the environment.
Select one of the options for adding hosts, and then continue to the relevant section below:
You can either add a host from a cloud provider that Rancher v2.0 supports, or you can add a custom host. If you don’t see your cloud provider in the UI, don’t worry. Simply use the custom host option.
If you’re adding a custom host, note these requirements:
rancher/servercontainer, you might need to explicitly specify its IP address. To do so, click Show advanced options, and then enter the Registration IP Address.
On the Add Hosts page, select your cloud provider:
Follow the instructions in the Rancher UI to add your host. This process might take a few minutes to complete. Once your host is ready, you can view its status on the Hosts page.
On the Add Hosts page, click Custom. A
docker command displays. For example:
sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v2.0-alpha2 http://<SERVER_IP>:8080/v3/scripts/D5433C26EC51325F9D98:1483142400000:KvILQKwz1N2MpOkOiIvGYKKGdE
Note: The IP address in the command must match your
<SERVER_IP>and must be reachable from inside your host.
dockercommand on your host. This process might take a few minutes to complete.
In Rancher v2.0, you can import an existing, external installation of Kubernetes v1.7+. In this scenario, the cluster provider manages your hosts outside of Rancher. We support hosted services like Google Container Engine, Azure Container Service, IBM Bluemix, and bring-your-own-Kubernetes installations.
kubectlcommand displays in the UI. Copy, paste, and execute this command against your Kubernetes cluster. This process might take a few minutes to complete.
After you add at least one host or cluster to your environment, it might take several minutes for all Rancher system services to launch. To verify the status of your environment, from the Default menu, select System. If a service is healthy, its state displays in green.
Once you’ve verified that all system services are up and running, you’re ready to create your first container.
Now that you’ve added hosts and your first container is up and running, you can check out the rest of our new features in Rancher v2.0.
To help you deploy complex stacks, Rancher offers a catalog of application templates.
Complete the required fields.
Note: To review the
rancher-compose.ymlfiles used to generate the stacks, click Preview before launching the stack.
Once its services are up and running, the state of your new stack displays in green.
From the Rancher UI, you can access the native Kubernetes dashboard with one click.
You can also run
kubectl from your web browser. The Kubernetes CLI, or
kubectl, helps you deploy and manage your Kubernetes applications. For more information, or to download
kubectl, visit the Kubernetes documentation.
In addition, you can generate a Kubernetes configuration file to use
kubectl on your desktop. A Kubernetes configuration file, i.e. kubeconfig, lets you configure access to one or more clusters.
kubectlcommands from your browser using shell. Click Close to return to the Rancher UI.
kubectlon your desktop. Copy and paste the code that displays into your
~/.kube/configfile, and then run
kubectl. Click Close to return to the Rancher UI.