Set up the Rancher server’s local Kubernetes cluster.
The cluster requirements depend on the Rancher version:
For the tutorial to install an RKE Kubernetes cluster, refer to this page. For help setting up the infrastructure for a high-availability RKE cluster, refer to this page.
For the tutorial to install a K3s Kubernetes cluster, refer to this page. For help setting up the infrastructure for a high-availability K3s cluster, refer to this page.
Rancher is installed using the Helm package manager for Kubernetes. Helm charts provide templating syntax for Kubernetes YAML manifest documents.
With Helm, we can create configurable deployments instead of just using static files. For more information about creating your own catalog of deployments, check out the docs at https://helm.sh/.
For systems without direct internet access, see Air Gap: Kubernetes install.
To choose a Rancher version to install, refer to Choosing a Rancher Version.
To choose a version of Helm to install Rancher with, refer to the Helm version requirements
NOTE: The installation instructions assume you are using Helm 3. For migration of installs started with Helm 2, refer to the official Helm 2 to 3 migration docs. This section provides a copy of the older installation instructions for Rancher installed on an RKE Kubernetes cluster with Helm 2, and it is intended to be used if upgrading to Helm 3 is not feasible.
To set up Rancher,
The following CLI tools are required for setting up the Kubernetes cluster. Please make sure these tools are installed and available in your $PATH
.
Refer to the instructions provided by the Helm project for your specific platform.
Use helm repo add
command to add the Helm chart repository that contains charts to install Rancher. For more information about the repository choices and which is best for your use case, see Choosing a Version of Rancher.
helm repo add rancher-<CHART_REPO> https://releases.rancher.com/server-charts/<CHART_REPO>
We’ll need to define a Kubernetes namespace where the resources created by the Chart should be installed. This should always be cattle-system
:
kubectl create namespace cattle-system
The Rancher management server is designed to be secure by default and requires SSL/TLS configuration.
NOTE: If you want terminate SSL/TLS externally, see TLS termination on an External Load Balancer.
There are three recommended options for the source of the certificate used for TLS termination at the Rancher server:
cert-manager
into the cluster. Rancher utilizes cert-manager
to issue and maintain its certificates. Rancher will generate a CA certificate of its own, and sign a cert using that CA. cert-manager
is then responsible for managing that certificate.cert-manager
. However, in this case, cert-manager is combined with a special Issuer for Let’s Encrypt that performs all actions (including request and validation) necessary for getting a Let’s Encrypt issued cert. This configuration uses HTTP validation (HTTP-01
), so the load balancer must have a public DNS record and be accessible from the internet.tls.crt
and tls.key
. If you are using a private CA, you must also upload that certificate. This is due to the fact that this private CA may not be trusted by your nodes. Rancher will take that CA certificate, and generate a checksum from it, which the various Rancher components will use to validate their connection to Rancher.Configuration | Helm Chart Option | Requires cert-manager |
---|---|---|
Rancher Generated Certificates (Default) | ingress.tls.source=rancher |
yes |
Let’s Encrypt | ingress.tls.source=letsEncrypt |
yes |
Certificates from Files | ingress.tls.source=secret |
no |
You should skip this step if you are bringing your own certificate files (option
ingress.tls.source=secret
), or if you use TLS termination on an external load balancer.
This step is only required to use certificates issued by Rancher’s generated CA (ingress.tls.source=rancher
) or to request Let’s Encrypt issued certificates (ingress.tls.source=letsEncrypt
).
The exact command to install Rancher differs depending on the certificate configuration.
The Rancher chart configuration has many options for customizing the installation to suit your specific environment. Here are some common advanced scenarios.
See the Chart Options for the full list of options.
After adding the secrets, check if Rancher was rolled out successfully:
kubectl -n cattle-system rollout status deploy/rancher
Waiting for deployment "rancher" rollout to finish: 0 of 3 updated replicas are available...
deployment "rancher" successfully rolled out
If you see the following error: error: deployment "rancher" exceeded its progress deadline
, you can check the status of the deployment by running the following command:
kubectl -n cattle-system get deploy rancher
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
rancher 3 3 3 3 3m
It should show the same count for DESIRED
and AVAILABLE
.
Make sure you save the --set
options you used. You will need to use the same options when you upgrade Rancher to new versions with Helm.
That’s it. You should have a functional Rancher server.
In a web browser, go to the DNS name that forwards traffic to your load balancer. Then you should be greeted by the colorful login page.
Doesn’t work? Take a look at the Troubleshooting Page
Enable the Enterprise Cluster Manager.