mirror of
https://github.com/rancher/rancher-docs.git
synced 2026-09-25 04:28:15 +00:00
quick-start and install
This commit is contained in:
@@ -4,3 +4,5 @@ shortTitle: RKE
|
||||
weight: 1
|
||||
draft: true
|
||||
---
|
||||
|
||||
Rancher Kubernetes Engine (RKE) is a lightweight tool for installing Kubernetes that supports installation on bare-metal and virtualized servers. RKE is a Kubernetes installer written in Golang. It’s easy to use and doesn’t require a lot of preparation from the user to get started. Kubernetes installation is considered one of the toughest problems for operators and DevOps. Because Kubernetes can run on various platforms and operating systems, there are so many factors that need to be considered during the installation process.
|
||||
|
||||
@@ -76,13 +76,12 @@ You can specify the list of roles that you want the node to be as part of the Ku
|
||||
|
||||
* **etcd**
|
||||
|
||||
With this role, the `etcd` container will be run on these nodes. Although you can run etcd on just one node, it typically takes 3, 5 or more nodes to create an HA configuration. Etcd is a distributed reliable key-value store which stores all Kubernetes state.
|
||||
With this role, the `etcd` container will be run on these nodes. Etcd keeps the state of your cluster and is the most important component in your cluster, single source of truth of your cluster. Although you can run etcd on just one node, it typically takes 3, 5 or more nodes to create an HA configuration. Etcd is a distributed reliable key-value store which stores all Kubernetes state.
|
||||
|
||||
* **controlplane**
|
||||
|
||||
With this role, the stateless components that are used to deploy Kubernetes will run on these nodes. These components are used to run the API server, scheduler, and controllers.
|
||||
|
||||
|
||||
* **worker**
|
||||
|
||||
With this role, any workloads or pods that are deployed will land on these nodes.
|
||||
|
||||
@@ -4,8 +4,6 @@ weight: 50
|
||||
draft: true
|
||||
---
|
||||
|
||||
<!-- Mohamed: Refer to the blog to see how this could be better written-->
|
||||
|
||||
## Requirements
|
||||
|
||||
- Docker versions `1.11.2` up to `1.13.1` and `17.03.x` are validated for Kubernetes versions 1.8, 1.9 and 1.10
|
||||
@@ -19,32 +17,66 @@ usermod -aG docker <user_name>
|
||||
- Ports 6443, 2379, and 2380 should be opened between cluster nodes.
|
||||
- Swap disabled on worker nodes.
|
||||
|
||||
### Download the rke binary
|
||||
---
|
||||
title: Quick Start Guide
|
||||
short title: Quick Start
|
||||
weight: 25
|
||||
draft: true
|
||||
---
|
||||
|
||||
Browse to the [latest release](https://github.com/rancher/rke/releases/latest) and download `rke_darwin-amd64` for MacOS and `rke_linux-amd64` if you use a Linux machine.
|
||||
RKE is a fast, versatile Kubernetes installer that you can use to install Kubernetes on your Linux hosts. You can get started in a couple of quick and easy steps:
|
||||
|
||||
When you have downloaded the binary, you can make it executable by running `chmod +x rke_darwin-amd64` or `chmod +x rke_linux-amd64`.
|
||||
1. [Download the RKE Binary](#download-the-rke-bindary)
|
||||
2. [Prepare the Nodes for the Kubernetes Cluster](#prepare-the-nodes-for-the-kubernetes-cluster)
|
||||
3. [Creating the Cluster Configuration File](#creating-the-cluster-configuration-file)
|
||||
4. [Deploying Kubernetes with RKE](#deploying-kubernetes-with-rke)
|
||||
5. [Interacting with your Kubernetes Cluster](#interacting-with-your-kubernetes-cluster)
|
||||
|
||||
After, you can test if it's executable by running `./rke_darwin-amd64 -version` or `./rke_linux-amd64 -version`.
|
||||
## Download the RKE binary
|
||||
|
||||
```bash
|
||||
$ chmod +x rke_darwin-amd64
|
||||
$ ./rke_darwin-amd64 -version
|
||||
rke version v0.1.5
|
||||
```
|
||||
1. From your workstation, open a web browser and navigate to our [RKE Releases](https://github.com/rancher/rke/releases/latest) page. Download the latest RKE installer applicable to your Operating System:
|
||||
|
||||
### Preparing Linux machines to be used in the cluster
|
||||
- **MacOS**: `rke_darwin-amd64`
|
||||
- **Linux**: `rke_linux-amd64`
|
||||
- **Windows**: `rke_windows-amd64.exe`
|
||||
|
||||
The Kubernetes cluster components are launched using Docker on a Linux machine. You can use any Linux you want, as long as you can install Docker on it. The most commonly used OS is the current Ubuntu LTS release, 16.04. Kubernetes runs integration tests on the following Docker versions: `1.11.2` to `1.13.1`, and `17.03.x`. We follow these tested Docker versions by marking them as supported. To make installing Docker easy, we've created `install-docker` scripts. Pick the version you want to install and run the command in the `Install Script` column to install it.
|
||||
2. Make the RKE binary that you just downloaded executable. Open Terminal, change directory to the location of the RKE binary, and then run one of the commands below.
|
||||
|
||||
Version | Supported? | Install Script |
|
||||
----------|------------|------------------
|
||||
`1.11.2` | Yes | <code>curl https://releases.rancher.com/install-docker/1.11.sh | sh</code> |
|
||||
`1.12.6` | Yes | <code>curl https://releases.rancher.com/install-docker/1.12.sh | sh</code> |
|
||||
`1.13.1` | Yes | <code>curl https://releases.rancher.com/install-docker/1.13.sh | sh</code> |
|
||||
`17.03.2` | Yes | <code>curl https://releases.rancher.com/install-docker/17.03.sh | sh</code> |
|
||||
>**Using Windows?**
|
||||
>The file is already an executable. Skip to [Prepare the Nodes for the Kubernetes Cluster](#prepare-the-nodes-for-the-kubernetes-cluster).
|
||||
|
||||
You can test if Docker is installed correctly by running `docker version`, it should show the client and server version.
|
||||
```
|
||||
# MacOS
|
||||
$ chmod +x rke_darwin-amd64
|
||||
# Linux
|
||||
$ chmod +x rke_linux-amd64
|
||||
```
|
||||
|
||||
3. Confirm that RKE is now executable by running the following command:
|
||||
|
||||
```
|
||||
# MacOS
|
||||
$ ./rke_darwin-amd64 --version
|
||||
# Linux
|
||||
$ ./rke_linux-amd64 --version
|
||||
```
|
||||
|
||||
## Prepare the Nodes for the Kubernetes cluster
|
||||
|
||||
The Kubernetes cluster components are launched using Docker on a Linux machine. You can use any Linux you want, as long as you can install Docker on it. The most commonly used OS is the current Ubuntu LTS release, 16.04. Kubernetes runs integration tests on the following Docker versions: `1.11.2` to `1.13.1`, and `17.03.x`. We follow these tested Docker versions by marking them as supported.
|
||||
|
||||
### Install Docker
|
||||
|
||||
You can either follow the [Docker installation](https://docs.docker.com/install/) instructions or you can use one of Rancher's [install scripts](https://github.com/rancher/install-docker) to install Docker.
|
||||
|
||||
Docker Version | Install Script |
|
||||
----------|------------------
|
||||
1.11.2 | <code>curl https://releases.rancher.com/install-docker/1.11.sh | sh</code> |
|
||||
1.12.6 | <code>curl https://releases.rancher.com/install-docker/1.12.sh | sh</code> |
|
||||
1.13.1 | <code>curl https://releases.rancher.com/install-docker/1.13.sh | sh</code> |
|
||||
17.03.2 | <code>curl https://releases.rancher.com/install-docker/17.03.sh | sh</code> |
|
||||
|
||||
Confirm that a Kubernetes supported version of Docker is installed on your machine, by running `docker version`.
|
||||
|
||||
```bash
|
||||
$ docker version
|
||||
@@ -66,9 +98,11 @@ Server:
|
||||
Experimental: false
|
||||
```
|
||||
|
||||
To connect to the Kubernetes cluster, port `TCP/6443` needs to be opened to the machine. If you are using an external firewall, make sure you have this opened between the machine you are using to run `rke` and the machine you are going to use in the cluster. If you are using `iptables` or `firewalld`, you can use the following commands:
|
||||
### Port Requirements
|
||||
|
||||
Example opening port TCP/6443 using `iptables`
|
||||
In order for the Kubernetes cluster to be deployed, port `TCP/6443` needs to be opened to the machine. If you are using an external firewall, make sure you have this port opened between the machine you are using to run `rke` and the machine you are going to use in the cluster.
|
||||
|
||||
#### Opening port TCP/6443 using `iptables``
|
||||
|
||||
```bash
|
||||
# Open TCP/6443 for all
|
||||
@@ -78,7 +112,7 @@ iptables -A INPUT -p tcp --dport 6443 -j ACCEPT
|
||||
iptables -A INPUT -p tcp -s your_ip_here --dport 6443 -j ACCEPT
|
||||
```
|
||||
|
||||
Example opening port TCP/6443 using `firewalld`
|
||||
#### Opening port TCP/6443 using `firewalld`
|
||||
|
||||
```bash
|
||||
# Open TCP/6443 for all
|
||||
@@ -93,102 +127,54 @@ firewall-cmd --permanent --zone=public --add-rich-rule='
|
||||
firewall-cmd --reload
|
||||
```
|
||||
|
||||
## Creating your cluster configuration
|
||||
## Creating the Cluster Configuration File
|
||||
|
||||
### Using RKE to generate a cluster.yml
|
||||
RKE uses a cluster configuration file, referred to as `cluster.yml` to determine what nodes will be in the cluster and how to deploy Kubernetes. There are [many configuration options]({{< baseurl >}}/rke/v0.1.x/en/config-options/) that can be set in the `cluster.yml`. In our example, we will be assuming the minimum of one [node]({{< baseurl >}}/rke/v0.1.x/en/config-options/nodes) for your Kubernetes cluster.
|
||||
|
||||
RKE provides the command `rke config` to generate a cluster configuration template or to interactivity generate a working cluster configuration file.
|
||||
There are two easy ways to create a `cluster.yml`:
|
||||
|
||||
Start by running the following command:
|
||||
- Using our [minimal `cluster.yml`]({{< baseurl >}}/rke/v0.1.x/en/config-options/example-yamls/#minimal-cluster-yml-example) and updating it based on the node that you will be using.
|
||||
- Using `rke config` to query for all the information needed.
|
||||
|
||||
### Using `rke config`
|
||||
|
||||
RKE provides the command `rke config` to generate a cluster configuration template or to interactivity generate a working cluster configuration file. Review [our cluster configuration options]({{< baseurl >}}/rke/v0.1.x/en/config-options/) to understand what each question means.
|
||||
|
||||
#### Creating a Basic `cluster.yml`
|
||||
```bash
|
||||
rke config --name cluster.yml
|
||||
$ rke config --name cluster.yml
|
||||
```
|
||||
|
||||
RKE will interactivity prompt the user for cluster configuration such as number of the hosts, IP addresses or hostnames, ssh users..etc.
|
||||
After answering the list of questions, there is a `cluster.yml` created in the directory where you launched the `rke config` command.
|
||||
|
||||
You can also use the `--empty` flag, which will generate an empty cluster.yml template:
|
||||
```bash
|
||||
rke config --empty --name cluster.yml
|
||||
```
|
||||
#### Creating an Empty `cluster.yml`
|
||||
|
||||
Additionally, it's possible to print the generated configuration to stdout and skip creating a file using the `--print` flag:
|
||||
If you want an empty `cluster.yml` template, you can use the `--empty` flag so that a template is produced, but there are no values in the template.
|
||||
|
||||
```bash
|
||||
rke config --print
|
||||
$ rke config --empty --name cluster.yml
|
||||
```
|
||||
|
||||
#### Printing the `cluster.yml`
|
||||
|
||||
|
||||
### Creating your first Kubernetes cluster
|
||||
|
||||
For this quick start, we will be configuring one machine. There are 3 roles you can define on a machine:
|
||||
|
||||
Role | Description |
|
||||
----------|----------|
|
||||
etcd | Keeps the state of your cluster and is the most important component in your cluster, single source of truth of your cluster. |
|
||||
controlplane | Responsible of running all the master components of your cluster, like the `kube-apiserver`, `controller-manager` and the `scheduler`. |
|
||||
worker | Workers will run the actual workloads. |
|
||||
|
||||
<br>
|
||||
|
||||
To create the `cluster.yml`, you can run `./rke_darwin-amd64 config` or `./rke_linux-amd64 config`. It will query you for all the information needed to build your cluster.
|
||||
Instead of creating a file, you can print the generated configuration to stdout using the `--print` flag.
|
||||
|
||||
```bash
|
||||
./rke_darwin-amd64 config
|
||||
# SSH private key location to use
|
||||
[+] Cluster Level SSH Private Key Path [~/.ssh/id_rsa]: ~/.ssh/your_rsa_key
|
||||
# For this example we'll be using one host
|
||||
[+] Number of Hosts [1]:
|
||||
# Address where the host is reachable over SSH
|
||||
[+] SSH Address of host (1) [none]: 10.0.0.1
|
||||
# SSH Port to use
|
||||
[+] SSH Port of host (1) [22]:
|
||||
# You can configure SSH keys per configured host, not needed in this example
|
||||
[+] SSH Private Key Path of host (10.0.0.1) [none]:
|
||||
[-] You have entered empty SSH key path, trying fetch from SSH key parameter
|
||||
[+] SSH Private Key of host (10.0.0.1) [none]:
|
||||
[-] You have entered empty SSH key, defaulting to cluster level SSH key: ~/.ssh/your_rsa_key
|
||||
# Username to use for the SSH connection
|
||||
[+] SSH User of host (10.0.0.1) [ubuntu]: root
|
||||
# We'll be configuring all three roles onto this single host
|
||||
[+] Is host (10.0.0.1) a control host (y/n)? [y]: y
|
||||
[+] Is host (10.0.0.1) a worker host (y/n)? [n]: y
|
||||
[+] Is host (10.0.0.1) an Etcd host (y/n)? [n]: y
|
||||
# If you want to override the hostname for this host, you can specify that here
|
||||
[+] Override Hostname of host (10.0.0.1) [none]:
|
||||
# If the host has multiple network connections, you can specify a private network connection here
|
||||
[+] Internal IP of host (10.0.0.1) [none]:
|
||||
# The location of the Docker socket
|
||||
[+] Docker socket path on host (10.0.0.1) [/var/run/docker.sock]:
|
||||
# Network plugin to use for your cluster
|
||||
[+] Network Plugin Type (flannel, calico, weave, canal) [flannel]:
|
||||
# We will be using certificates as authentication strategy
|
||||
[+] Authentication Strategy [x509]:
|
||||
# RBAC will be turned on
|
||||
[+] Authorization Mode (rbac, none) [rbac]:
|
||||
# Images to use for your cluster
|
||||
[+] Etcd Docker Image [rancher/coreos-etcd:v3.0.17]:
|
||||
[+] Kubernetes Docker image [rancher/k8s:v1.8.9-rancher1-1]:
|
||||
# Internal cluster domain to be used
|
||||
[+] Cluster domain [cluster.local]:
|
||||
# IP ranges to be used by the clusters
|
||||
[+] Service Cluster IP Range [10.233.0.0/18]:
|
||||
# If we want to use PodSecurityPolicy
|
||||
[+] Enable PodSecurityPolicy [n]:
|
||||
[+] Cluster Network CIDR [10.233.64.0/18]:
|
||||
[+] Cluster DNS Service IP [10.233.0.3]:
|
||||
# The container image to be used by Kubernetes pods
|
||||
[+] Infra Container image [rancher/pause-amd64:3.0]:
|
||||
$ rke config --print
|
||||
```
|
||||
|
||||
There should be a `cluster.yml` created in the directory where you launched the rke command. If you have to correct anything, you can do that directly in the `cluster.yml` file.
|
||||
## Deploying Kubernetes with RKE
|
||||
|
||||
If you are satisfied with the configuration, you can start building your cluster by using `./rke_darwin-amd64 up` or `./rke_linux-amd64 up`.
|
||||
|
||||
### Running RKE
|
||||
After you've created your `cluster.yml`, you can deploy your cluster with a simple command. This command assumes the `cluster.yml` file is in the same directory as where you are running the command.
|
||||
|
||||
```
|
||||
# MacOS
|
||||
$ ./rke_darwin-amd64 up
|
||||
# Linux
|
||||
$ ./rke_linux-amd64 up
|
||||
```
|
||||
|
||||
There will be log statements as the Kubernetes cluster is created.
|
||||
|
||||
```bash
|
||||
$ ./rke_darwin-amd64 up
|
||||
@@ -200,22 +186,23 @@ INFO[0000] [network] Pulling image [alpine:latest] on host [10.0.0.1]
|
||||
INFO[0101] Finished building Kubernetes cluster successfully
|
||||
```
|
||||
|
||||
The last line should read `Finished building Kubernetes cluster successfully` to indicate that your cluster is ready to use. A kubeconfig file has been written to `kube_config_cluster.yml` to be used to interact with your cluster.
|
||||
The last line should read `Finished building Kubernetes cluster successfully` to indicate that your cluster is ready to use. As part of the Kubernetes creation process, a `kubeconfig` file has been created and written at `kube_config_cluster.yml`, which can be used to start interacting your Kubernetes cluster.
|
||||
|
||||
### Interacting with your cluster
|
||||
### Interacting with your Kubernetes cluster
|
||||
|
||||
The way you interact with your cluster is by the use of a binary called `kubectl`. Before we can issue commands to our cluster, we need to download the `kubectl` binary. Please follow [the intructions](https://kubernetes.io/docs/tasks/tools/install-kubectl/) on the Kubernetes documentation page to install `kubectl`. You can verify the installation of `kubectl` and the connection to the cluster using `kubectl --kubeconfig kube_config_cluster.yml version`.
|
||||
In order to start interacting with your Kubernetes cluster, you will use a different binary called `kubectl`. You will need to [install kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) on your local machine. You can connect to the RKE created cluster by using the `kube_config_cluster.yml` that was generated when you deployed Kubernetes.
|
||||
|
||||
```bash
|
||||
# Confirm that kubectl is working by checking the version of your Kubernetes cluster
|
||||
$ kubectl --kubeconfig kube_config_cluster.yml version
|
||||
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.0", GitCommit:"fc32d2f3698e36b93322a3465f63a14e9f0eaead", GitTreeState:"clean", BuildDate:"2018-03-27T00:13:02Z", GoVersion:"go1.9.4", Compiler:"gc", Platform:"darwin/amd64"}
|
||||
Server Version: version.Info{Major:"1", Minor:"8+", GitVersion:"v1.8.9-rancher1", GitCommit:"68595e18f25e24125244e9966b1e5468a98c1cd4", GitTreeState:"clean", BuildDate:"2018-03-13T04:37:53Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
|
||||
```
|
||||
|
||||
The client and server version are reported, indicating that you have a local `kubectl` client and are able to request the server version from the newly built cluster. Now you can issue any command to your cluster, like requesting the nodes that are in the cluster using `kubectl --kubeconfig kube_config_cluster.yml get nodes`
|
||||
The client and server version are reported, indicating that you have a local `kubectl` client and are able to request the server version from the newly built cluster. Now, you can issue any command to your cluster, like requesting the nodes that are in the cluster.
|
||||
|
||||
```bash
|
||||
$ kubectl --kubeconfig kube_config_cluster.yml get nodes
|
||||
NAME STATUS ROLES AGE VERSION
|
||||
10.0.0.1 Ready controlplane,etcd,worker 35m v1.8.9-rancher1
|
||||
10.0.0.1 Ready controlplane,etcd,worker 35m v1.10.3-rancher1
|
||||
```
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
---
|
||||
title: Overview
|
||||
weight: 1
|
||||
draft: true
|
||||
---
|
||||
|
||||
Rancher Kubernetes Engine (RKE) is an extremely simple, lightning fast Kubernetes installer that works everywhere.
|
||||
@@ -5,32 +5,59 @@ weight: 25
|
||||
draft: true
|
||||
---
|
||||
|
||||
### Get the rke binary
|
||||
RKE is a fast, versatile Kubernetes installer that you can use to install Kubernetes on your Linux hosts. You can get started in a couple of quick and easy steps:
|
||||
|
||||
Browse to the [latest release](https://github.com/rancher/rke/releases/latest) and download `rke_darwin-amd64` for MacOS and `rke_linux-amd64` if you use a Linux machine.
|
||||
1. [Download the RKE Binary](#download-the-rke-bindary)
|
||||
2. [Prepare the Nodes for the Kubernetes Cluster](#prepare-the-nodes-for-the-kubernetes-cluster)
|
||||
3. [Creating the Cluster Configuration File](#creating-the-cluster-configuration-file)
|
||||
4. [Deploying Kubernetes with RKE](#deploying-kubernetes-with-rke)
|
||||
5. [Interacting with your Kubernetes Cluster](#interacting-with-your-kubernetes-cluster)
|
||||
|
||||
When you have downloaded the binary, you can make it executable by running `chmod +x rke_darwin-amd64` or `chmod +x rke_linux-amd64`.
|
||||
## Download the RKE binary
|
||||
|
||||
After, you can test if it's executable by running `./rke_darwin-amd64 -version` or `./rke_linux-amd64 -version`.
|
||||
1. From your workstation, open a web browser and navigate to our [RKE Releases](https://github.com/rancher/rke/releases/latest) page. Download the latest RKE installer applicable to your Operating System:
|
||||
|
||||
```bash
|
||||
$ chmod +x rke_darwin-amd64
|
||||
$ ./rke_darwin-amd64 -version
|
||||
rke version v0.1.5
|
||||
```
|
||||
- **MacOS**: `rke_darwin-amd64`
|
||||
- **Linux**: `rke_linux-amd64`
|
||||
- **Windows**: `rke_windows-amd64.exe`
|
||||
|
||||
### Preparing Linux machines to be used in the cluster
|
||||
2. Make the RKE binary that you just downloaded executable. Open Terminal, change directory to the location of the RKE binary, and then run one of the commands below.
|
||||
|
||||
The Kubernetes cluster components are launched using Docker on a Linux machine. You can use any Linux you want, as long as you can install Docker on it. The most commonly used OS is the current Ubuntu LTS release, 16.04. Kubernetes runs integration tests on the following Docker versions: `1.11.2` to `1.13.1`, and `17.03.x`. We follow these tested Docker versions by marking them as supported. To make installing Docker easy, we've created `install-docker` scripts. Pick the version you want to install and run the command in the `Install Script` column to install it.
|
||||
>**Using Windows?**
|
||||
>The file is already an executable. Skip to [Prepare the Nodes for the Kubernetes Cluster](#prepare-the-nodes-for-the-kubernetes-cluster).
|
||||
|
||||
Version | Supported? | Install Script |
|
||||
----------|------------|------------------
|
||||
`1.11.2` | Yes | <code>curl https://releases.rancher.com/install-docker/1.11.sh | sh</code> |
|
||||
`1.12.6` | Yes | <code>curl https://releases.rancher.com/install-docker/1.12.sh | sh</code> |
|
||||
`1.13.1` | Yes | <code>curl https://releases.rancher.com/install-docker/1.13.sh | sh</code> |
|
||||
`17.03.2` | Yes | <code>curl https://releases.rancher.com/install-docker/17.03.sh | sh</code> |
|
||||
```
|
||||
# MacOS
|
||||
$ chmod +x rke_darwin-amd64
|
||||
# Linux
|
||||
$ chmod +x rke_linux-amd64
|
||||
```
|
||||
|
||||
You can test if Docker is installed correctly by running `docker version`, it should show the client and server version.
|
||||
3. Confirm that RKE is now executable by running the following command:
|
||||
|
||||
```
|
||||
# MacOS
|
||||
$ ./rke_darwin-amd64 --version
|
||||
# Linux
|
||||
$ ./rke_linux-amd64 --version
|
||||
```
|
||||
|
||||
## Prepare the Nodes for the Kubernetes cluster
|
||||
|
||||
The Kubernetes cluster components are launched using Docker on a Linux machine. You can use any Linux you want, as long as you can install Docker on it. The most commonly used OS is the current Ubuntu LTS release, 16.04. Kubernetes runs integration tests on the following Docker versions: `1.11.2` to `1.13.1`, and `17.03.x`. We follow these tested Docker versions by marking them as supported.
|
||||
|
||||
### Install Docker
|
||||
|
||||
You can either follow the [Docker installation](https://docs.docker.com/install/) instructions or you can use one of Rancher's [install scripts](https://github.com/rancher/install-docker) to install Docker.
|
||||
|
||||
Docker Version | Install Script |
|
||||
----------|------------------
|
||||
1.11.2 | <code>curl https://releases.rancher.com/install-docker/1.11.sh | sh</code> |
|
||||
1.12.6 | <code>curl https://releases.rancher.com/install-docker/1.12.sh | sh</code> |
|
||||
1.13.1 | <code>curl https://releases.rancher.com/install-docker/1.13.sh | sh</code> |
|
||||
17.03.2 | <code>curl https://releases.rancher.com/install-docker/17.03.sh | sh</code> |
|
||||
|
||||
Confirm that a Kubernetes supported version of Docker is installed on your machine, by running `docker version`.
|
||||
|
||||
```bash
|
||||
$ docker version
|
||||
@@ -52,9 +79,11 @@ Server:
|
||||
Experimental: false
|
||||
```
|
||||
|
||||
To connect to the Kubernetes cluster, port `TCP/6443` needs to be opened to the machine. If you are using an external firewall, make sure you have this opened between the machine you are using to run `rke` and the machine you are going to use in the cluster. If you are using `iptables` or `firewalld`, you can use the following commands:
|
||||
### Port Requirements
|
||||
|
||||
Example opening port TCP/6443 using `iptables`
|
||||
In order for the Kubernetes cluster to be deployed, port `TCP/6443` needs to be opened to the machine. If you are using an external firewall, make sure you have this port opened between the machine you are using to run `rke` and the machine you are going to use in the cluster.
|
||||
|
||||
#### Opening port TCP/6443 using `iptables``
|
||||
|
||||
```bash
|
||||
# Open TCP/6443 for all
|
||||
@@ -64,7 +93,7 @@ iptables -A INPUT -p tcp --dport 6443 -j ACCEPT
|
||||
iptables -A INPUT -p tcp -s your_ip_here --dport 6443 -j ACCEPT
|
||||
```
|
||||
|
||||
Example opening port TCP/6443 using `firewalld`
|
||||
#### Opening port TCP/6443 using `firewalld`
|
||||
|
||||
```bash
|
||||
# Open TCP/6443 for all
|
||||
@@ -79,71 +108,54 @@ firewall-cmd --permanent --zone=public --add-rich-rule='
|
||||
firewall-cmd --reload
|
||||
```
|
||||
|
||||
### Creating `cluster.yml` and Kubernetes cluster
|
||||
## Creating the Cluster Configuration File
|
||||
|
||||
For this quick start, we will be configuring one machine. There are 3 roles you can define on a machine:
|
||||
RKE uses a cluster configuration file, referred to as `cluster.yml` to determine what nodes will be in the cluster and how to deploy Kubernetes. There are [many configuration options]({{< baseurl >}}/rke/v0.1.x/en/config-options/) that can be set in the `cluster.yml`. In our example, we will be assuming the minimum of one [node]({{< baseurl >}}/rke/v0.1.x/en/config-options/nodes) for your Kubernetes cluster.
|
||||
|
||||
Role | Description |
|
||||
----------|----------|
|
||||
etcd | Keeps the state of your cluster and is the most important component in your cluster, single source of truth of your cluster. |
|
||||
controlplane | Responsible of running all the master components of your cluster, like the `kube-apiserver`, `controller-manager` and the `scheduler`. |
|
||||
worker | Workers will run the actual workloads. |
|
||||
There are two easy ways to create a `cluster.yml`:
|
||||
|
||||
<br>
|
||||
- Using our [minimal `cluster.yml`]({{< baseurl >}}/rke/v0.1.x/en/config-options/example-yamls/#minimal-cluster-yml-example) and updating it based on the node that you will be using.
|
||||
- Using `rke config` to query for all the information needed.
|
||||
|
||||
To create the `cluster.yml`, you can run `./rke_darwin-amd64 config` or `./rke_linux-amd64 config`. It will query you for all the information needed to build your cluster.
|
||||
### Using `rke config`
|
||||
|
||||
To create a new `cluster.yml`, you can run `rke config` and this command will query for all the information needed to build your cluster. Review [our cluster configuration options]({{< baseurl >}}/rke/v0.1.x/en/config-options/) to understand what each question means. The ones that are required for this quick start guide are in the example below.
|
||||
|
||||
> **Note:** As features are added into RKE, the list and order of questions may change.
|
||||
|
||||
```bash
|
||||
./rke_darwin-amd64 config
|
||||
# SSH private key location to use
|
||||
[+] Cluster Level SSH Private Key Path [~/.ssh/id_rsa]: ~/.ssh/your_rsa_key
|
||||
# For this example we'll be using one host
|
||||
[+] Number of Hosts [1]:
|
||||
|
||||
# This example is using one host
|
||||
[+] Number of Hosts [1]: 1
|
||||
# Address where the host is reachable over SSH
|
||||
[+] SSH Address of host (1) [none]: 10.0.0.1
|
||||
# SSH Port to use
|
||||
[+] SSH Port of host (1) [22]:
|
||||
# You can configure SSH keys per configured host, not needed in this example
|
||||
[+] SSH Private Key Path of host (10.0.0.1) [none]:
|
||||
[-] You have entered empty SSH key path, trying fetch from SSH key parameter
|
||||
[+] SSH Private Key of host (10.0.0.1) [none]:
|
||||
[-] You have entered empty SSH key, defaulting to cluster level SSH key: ~/.ssh/your_rsa_key
|
||||
[+] SSH Port of host (1) [22]: 22
|
||||
[+] SSH Private Key Path of host (10.0.0.1) [none]: ~/.ssh/your_rsa_key
|
||||
# Username to use for the SSH connection
|
||||
[+] SSH User of host (10.0.0.1) [ubuntu]: root
|
||||
|
||||
# We'll be configuring all three roles onto this single host
|
||||
[+] Is host (10.0.0.1) a control host (y/n)? [y]: y
|
||||
[+] Is host (10.0.0.1) a worker host (y/n)? [n]: y
|
||||
[+] Is host (10.0.0.1) an Etcd host (y/n)? [n]: y
|
||||
# If you want to override the hostname for this host, you can specify that here
|
||||
[+] Override Hostname of host (10.0.0.1) [none]:
|
||||
# If the host has multiple network connections, you can specify a private network connection here
|
||||
[+] Internal IP of host (10.0.0.1) [none]:
|
||||
# The location of the Docker socket
|
||||
[+] Docker socket path on host (10.0.0.1) [/var/run/docker.sock]:
|
||||
# Network plugin to use for your cluster
|
||||
[+] Network Plugin Type (flannel, calico, weave, canal) [flannel]:
|
||||
# We will be using certificates as authentication strategy
|
||||
[+] Authentication Strategy [x509]:
|
||||
# RBAC will be turned on
|
||||
[+] Authorization Mode (rbac, none) [rbac]:
|
||||
# Images to use for your cluster
|
||||
[+] Etcd Docker Image [rancher/coreos-etcd:v3.0.17]:
|
||||
[+] Kubernetes Docker image [rancher/k8s:v1.8.9-rancher1-1]:
|
||||
# Internal cluster domain to be used
|
||||
[+] Cluster domain [cluster.local]:
|
||||
# IP ranges to be used by the clusters
|
||||
[+] Service Cluster IP Range [10.233.0.0/18]:
|
||||
# If we want to use PodSecurityPolicy
|
||||
[+] Enable PodSecurityPolicy [n]:
|
||||
[+] Cluster Network CIDR [10.233.64.0/18]:
|
||||
[+] Cluster DNS Service IP [10.233.0.3]:
|
||||
# The container image to be used by Kubernetes pods
|
||||
[+] Infra Container image [rancher/pause-amd64:3.0]:
|
||||
```
|
||||
|
||||
There should be a `cluster.yml` created in the directory where you launched the rke command. If you have to correct anything, you can do that directly in the `cluster.yml` file.
|
||||
After answering the list of questions, there is a `cluster.yml` created in the directory where you launched the `rke config` command. After the `cluster.yml` is created, you can edit the file to make any changes.
|
||||
|
||||
If you are satisfied with the configuration, you can start building your cluster by using `./rke_darwin-amd64 up` or `./rke_linux-amd64 up`.
|
||||
## Deploying Kubernetes with RKE
|
||||
|
||||
After you've created your `cluster.yml`, you can deploy your cluster with a simple command. This command assumes the `cluster.yml` file is in the same directory as where you are running the command.
|
||||
|
||||
```
|
||||
# MacOS
|
||||
$ ./rke_darwin-amd64 up
|
||||
# Linux
|
||||
$ ./rke_linux-amd64 up
|
||||
```
|
||||
|
||||
There will be log statements as the Kubernetes cluster is created.
|
||||
|
||||
```bash
|
||||
$ ./rke_darwin-amd64 up
|
||||
@@ -155,22 +167,23 @@ INFO[0000] [network] Pulling image [alpine:latest] on host [10.0.0.1]
|
||||
INFO[0101] Finished building Kubernetes cluster successfully
|
||||
```
|
||||
|
||||
The last line should read `Finished building Kubernetes cluster successfully` to indicate that your cluster is ready to use. A kubeconfig file has been written to `kube_config_cluster.yml` to be used to interact with your cluster.
|
||||
The last line should read `Finished building Kubernetes cluster successfully` to indicate that your cluster is ready to use. As part of the Kubernetes creation process, a `kubeconfig` file has been created and written at `kube_config_cluster.yml`, which can be used to start interacting your Kubernetes cluster.
|
||||
|
||||
### Interacting with your cluster
|
||||
### Interacting with your Kubernetes cluster
|
||||
|
||||
The way you interact with your cluster is by the use of a binary called `kubectl`. Before we can issue commands to our cluster, we need to download the `kubectl` binary. Please follow [the intructions](https://kubernetes.io/docs/tasks/tools/install-kubectl/) on the Kubernetes documentation page to install `kubectl`. You can verify the installation of `kubectl` and the connection to the cluster using `kubectl --kubeconfig kube_config_cluster.yml version`.
|
||||
In order to start interacting with your Kubernetes cluster, you will use a different binary called `kubectl`. You will need to [install kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) on your local machine. You can connect to the RKE created cluster by using the `kube_config_cluster.yml` that was generated when you deployed Kubernetes.
|
||||
|
||||
```bash
|
||||
# Confirm that kubectl is working by checking the version of your Kubernetes cluster
|
||||
$ kubectl --kubeconfig kube_config_cluster.yml version
|
||||
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.0", GitCommit:"fc32d2f3698e36b93322a3465f63a14e9f0eaead", GitTreeState:"clean", BuildDate:"2018-03-27T00:13:02Z", GoVersion:"go1.9.4", Compiler:"gc", Platform:"darwin/amd64"}
|
||||
Server Version: version.Info{Major:"1", Minor:"8+", GitVersion:"v1.8.9-rancher1", GitCommit:"68595e18f25e24125244e9966b1e5468a98c1cd4", GitTreeState:"clean", BuildDate:"2018-03-13T04:37:53Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
|
||||
```
|
||||
|
||||
The client and server version are reported, indicating that you have a local `kubectl` client and are able to request the server version from the newly built cluster. Now you can issue any command to your cluster, like requesting the nodes that are in the cluster using `kubectl --kubeconfig kube_config_cluster.yml get nodes`
|
||||
The client and server version are reported, indicating that you have a local `kubectl` client and are able to request the server version from the newly built cluster. Now, you can issue any command to your cluster, like requesting the nodes that are in the cluster.
|
||||
|
||||
```bash
|
||||
$ kubectl --kubeconfig kube_config_cluster.yml get nodes
|
||||
NAME STATUS ROLES AGE VERSION
|
||||
10.0.0.1 Ready controlplane,etcd,worker 35m v1.8.9-rancher1
|
||||
10.0.0.1 Ready controlplane,etcd,worker 35m v1.10.3-rancher1
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user