24 KiB
title
| title |
|---|
| Kubernetes Install with External Load Balancer (TCP/Layer 4) |
import SslFaqHa from '@site/src/components/SslFaqHa'
Important: RKE add-on install is only supported up to Rancher v2.0.8
Please use the Rancher helm chart to install Rancher on a Kubernetes cluster. For details, see the Kubernetes Install .
If you are currently using the RKE add-on install method, see Migrating from a High-availability Kubernetes install with an RKE add-on for details on how to move to using the Helm chart.
This procedure walks you through setting up a 3-node cluster using the Rancher Kubernetes Engine (RKE). The cluster's sole purpose is running pods for Rancher. The setup is based on:
- Layer 4 load balancer (TCP)
- NGINX ingress controller with SSL termination (HTTPS)
In a Kubernetes setup that uses a layer 4 load balancer, the load balancer accepts Rancher client connections over the TCP/UDP protocols (i.e., the transport level). The load balancer then forwards these connections to individual cluster nodes without reading the request itself. Because the load balancer cannot read the packets it's forwarding, the routing decisions it can make are limited.
Kubernetes Rancher install with layer 4 load balancer, depicting SSL termination at ingress controllers
1. Provision Linux Hosts
Provision three Linux hosts according to our Requirements.
2. Configure Load Balancer
We will be using NGINX as our Layer 4 Load Balancer (TCP). NGINX will forward all connections to one of your Rancher nodes. If you want to use Amazon NLB, you can skip this step and use Amazon NLB configuration
Note: In this configuration, the load balancer is positioned in front of your Linux hosts. The load balancer can be any host that you have available that's capable of running NGINX.
One caveat: do not use one of your Rancher nodes as the load balancer.
A. Install NGINX
Start by installing NGINX on your load balancer host. NGINX has packages available for all known operating systems. For help installing NGINX, refer to their install documentation.
The stream module is required, which is present when using the official NGINX packages. Please refer to your OS documentation how to install and enable the NGINX stream module on your operating system.
B. Create NGINX Configuration
After installing NGINX, you need to update the NGINX config file, nginx.conf, with the IP addresses for your nodes.
-
Copy and paste the code sample below into your favorite text editor. Save it as
nginx.conf. -
From
nginx.conf, replaceIP_NODE_1,IP_NODE_2, andIP_NODE_3with the IPs of your Linux hosts.Note: This Nginx configuration is only an example and may not suit your environment. For complete documentation, see NGINX Load Balancing - TCP and UDP Load Balancer.
Example NGINX config:
worker_processes 4; worker_rlimit_nofile 40000; events { worker_connections 8192; } http { server { listen 80; return 301 https://$host$request_uri; } } stream { upstream rancher_servers { least_conn; server IP_NODE_1:443 max_fails=3 fail_timeout=5s; server IP_NODE_2:443 max_fails=3 fail_timeout=5s; server IP_NODE_3:443 max_fails=3 fail_timeout=5s; } server { listen 443; proxy_pass rancher_servers; } } -
Save
nginx.confto your load balancer at the following path:/etc/nginx/nginx.conf. -
Load the updates to your NGINX configuration by running the following command:
# nginx -s reload
Option - Run NGINX as Docker container
Instead of installing NGINX as a package on the operating system, you can rather run it as a Docker container. Save the edited Example NGINX config as /etc/nginx.conf and run the following command to launch the NGINX container:
docker run -d --restart=unless-stopped \
-p 80:80 -p 443:443 \
-v /etc/nginx.conf:/etc/nginx/nginx.conf \
nginx:1.14
3. Configure DNS
Choose a fully qualified domain name (FQDN) that you want to use to access Rancher (e.g., rancher.yourdomain.com).
-
Log into your DNS server a create a
DNS Arecord that points to the IP address of your load balancer. -
Validate that the
DNS Ais working correctly. Run the following command from any terminal, replacingHOSTNAME.DOMAIN.COMwith your chosen FQDN:nslookup HOSTNAME.DOMAIN.COMStep Result: Terminal displays output similar to the following:
$ nslookup rancher.yourdomain.com Server: YOUR_HOSTNAME_IP_ADDRESS Address: YOUR_HOSTNAME_IP_ADDRESS#53 Non-authoritative answer: Name: rancher.yourdomain.com Address: HOSTNAME.DOMAIN.COM
4. Install RKE
RKE (Rancher Kubernetes Engine) is a fast, versatile Kubernetes installer that you can use to install Kubernetes on your Linux hosts. We will use RKE to setup our cluster and run Rancher.
-
Follow the RKE Install instructions.
-
Confirm that RKE is now executable by running the following command:
rke --version
5. Download RKE Config File Template
RKE uses a .yml config file to install and configure your Kubernetes cluster. There are 2 templates to choose from, depending on the SSL certificate you want to use.
-
Download one of following templates, depending on the SSL certificate you're using.
- Template for self-signed certificate
3-node-certificate.yml - Template for certificate signed by recognized CA
3-node-certificate-recognizedca.yml
Advanced Config Options:
- Want records of all transactions with the Rancher API? Enable the API Auditing feature by editing your RKE config file. For more information, see how to enable it in your RKE config file.
- Want to know the other config options available for your RKE template? See the RKE Documentation: Config Options.
- Template for self-signed certificate
-
Rename the file to
rancher-cluster.yml.
6. Configure Nodes
Once you have the rancher-cluster.yml config file template, edit the nodes section to point toward your Linux hosts.
-
Open
rancher-cluster.ymlin your favorite text editor. -
Update the
nodessection with the information of your Linux hosts.For each node in your cluster, update the following placeholders:
IP_ADDRESS_XandUSER. The specified user should be able to access the Docker socket, you can test this by logging in with the specified user and rundocker ps.Note: When using RHEL/CentOS, the SSH user can't be root due to https://bugzilla.redhat.com/show_bug.cgi?id=1527565. See Operating System Requirements >for RHEL/CentOS specific requirements.
nodes: # The IP address or hostname of the node - address: IP_ADDRESS_1 # User that can login to the node and has access to the Docker socket (i.e. can execute `docker ps` on the node) # When using RHEL/CentOS, this can't be root due to https://bugzilla.redhat.com/show_bug.cgi?id=1527565 user: USER role: [controlplane,etcd,worker] # Path the SSH key that can be used to access to node with the specified user ssh_key_path: ~/.ssh/id_rsa - address: IP_ADDRESS_2 user: USER role: [controlplane,etcd,worker] ssh_key_path: ~/.ssh/id_rsa - address: IP_ADDRESS_3 user: USER role: [controlplane,etcd,worker] ssh_key_path: ~/.ssh/id_rsa -
Optional: By default,
rancher-cluster.ymlis configured to take backup snapshots of your data. To disable these snapshots, change thebackupdirective setting tofalse, as depicted below.services: etcd: backup: false
7. Configure Certificates
For security purposes, SSL (Secure Sockets Layer) is required when using Rancher. SSL secures all Rancher network communication, like when you login or interact with a cluster.
Choose from the following options:
Option A—Bring Your Own Certificate: Self-Signed
Prerequisites: Create a self-signed certificate.
- The certificate files must be in PEM format.
- The certificate files must be encoded in base64.
- In your certificate file, include all intermediate certificates in the chain. Order your certificates with your certificate first, followed by the intermediates.
-
In
kind: Secretwithname: cattle-keys-ingress:- Replace
<BASE64_CRT>with the base64 encoded string of the Certificate file (usually calledcert.pemordomain.crt) - Replace
<BASE64_KEY>with the base64 encoded string of the Certificate Key file (usually calledkey.pemordomain.key)
Note: The base64 encoded string should be on the same line as
tls.crtortls.key, without any newline at the beginning, in between or at the end.Step Result: After replacing the values, the file should look like the example below (the base64 encoded strings should be different):
--- apiVersion: v1 kind: Secret metadata: name: cattle-keys-ingress namespace: cattle-system type: Opaque data: tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM1RENDQWN5Z0F3SUJBZ0lKQUlHc25NeG1LeGxLTUEwR0NTcUdTSWIzRFFFQkN3VUFNQkl4RURBT0JnTlYKQkFNTUIzUmxjM1F0WTJFd0hoY05NVGd3TlRBMk1qRXdOREE1V2hjTk1UZ3dOekExTWpFd05EQTVXakFXTVJRdwpFZ1lEVlFRRERBdG9ZUzV5Ym1Ob2NpNXViRENDQVNJd0RRWUpLb1pJaHZjTkFRRUJCUUFEZ2dFUEFEQ0NBUW9DCmdnRUJBTFJlMXdzekZSb2Rib2pZV05DSHA3UkdJaUVIMENDZ1F2MmdMRXNkUUNKZlcrUFEvVjM0NnQ3bSs3TFEKZXJaV3ZZMWpuY2VuWU5JSGRBU0VnU0ducWExYnhUSU9FaE0zQXpib3B0WDhjSW1OSGZoQlZETGdiTEYzUk0xaQpPM1JLTGdIS2tYSTMxZndjbU9zWGUwaElYQnpUbmxnM20vUzlXL3NTc0l1dDVwNENDUWV3TWlpWFhuUElKb21lCmpkS3VjSHFnMTlzd0YvcGVUalZrcVpuMkJHazZRaWFpMU41bldRV0pjcThTenZxTTViZElDaWlwYU9hWWQ3RFEKYWRTejV5dlF0YkxQNW4wTXpnOU43S3pGcEpvUys5QWdkWDI5cmZqV2JSekp3RzM5R3dRemN6VWtLcnZEb05JaQo0UFJHc01yclFNVXFSYjRSajNQOEJodEMxWXNDQXdFQUFhTTVNRGN3Q1FZRFZSMFRCQUl3QURBTEJnTlZIUThFCkJBTUNCZUF3SFFZRFZSMGxCQll3RkFZSUt3WUJCUVVIQXdJR0NDc0dBUVVGQndNQk1BMEdDU3FHU0liM0RRRUIKQ3dVQUE0SUJBUUNKZm5PWlFLWkowTF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ZjNaNExuYXpVc0F0UGhNS2hRWGMrcEFBWGthUDJkZzZ0TU5PazFxaUNHCndvU212a1BVVE84b1ViRTB1NFZ4ZmZFQ2dZQUpPdDNROVNadUlIMFpSSitIV095enlOQTRaUEkvUkhwN0RXS1QKajVFS2Y5VnR1OVMxY1RyOTJLVVhITXlOUTNrSjg2OUZPMnMvWk85OGg5THptQ2hDTjhkOWN6enI5SnJPNUFMTApqWEtBcVFIUlpLTFgrK0ZRcXZVVlE3cTlpaHQyMEZPb3E5OE5SZDMzSGYxUzZUWDNHZ3RWQ21YSml6dDAxQ3ZHCmR4VnVnd0tCZ0M2Mlp0b0RLb3JyT2hvdTBPelprK2YwQS9rNDJBOENiL29VMGpwSzZtdmxEWmNYdUF1QVZTVXIKNXJCZjRVYmdVYndqa1ZWSFR6LzdDb1BWSjUvVUxJWk1Db1RUNFprNTZXWDk4ZE93Q3VTVFpZYnlBbDZNS1BBZApTZEpuVVIraEpnSVFDVGJ4K1dzYnh2d0FkbWErWUhtaVlPRzZhSklXMXdSd1VGOURLUEhHCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg== - Replace
-
In
kind: Secretwithname: cattle-keys-server, replace<BASE64_CA>with the base64 encoded string of the CA Certificate file (usually calledca.pemorca.crt).Note: The base64 encoded string should be on the same line as
cacerts.pem, without any newline at the beginning, in between or at the end.Step Result: The file should look like the example below (the base64 encoded string should be different):
--- apiVersion: v1 kind: Secret metadata: name: cattle-keys-server namespace: cattle-system type: Opaque data: cacerts.pem: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNvRENDQVlnQ0NRRHVVWjZuMEZWeU16QU5CZ2txaGtpRzl3MEJBUXNGQURBU01SQXdEZ1lEVlFRRERBZDAKWlhOMExXTmhNQjRYRFRFNE1EVXdOakl4TURRd09Wb1hEVEU0TURjd05USXhNRFF3T1Zvd0VqRVFNQTRHQTFVRQpBd3dIZEdWemRDMWpZVENDQVNJd0RRWUpLb1pJaH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ring Your Own Certificate: Signed by Recognized CA
If you are using a Certificate Signed By A Recognized Certificate Authority, you will need to generate a base64 encoded string for the Certificate file and the Certificate Key file. Make sure that your certificate file includes all the intermediate certificates in the chain, the order of certificates in this case is first your own certificate, followed by the intermediates. Please refer to the documentation of your CSP (Certificate Service Provider) to see what intermediate certificate(s) need to be included.
In the kind: Secret with name: cattle-keys-ingress:
- Replace
<BASE64_CRT>with the base64 encoded string of the Certificate file (usually calledcert.pemordomain.crt) - Replace
<BASE64_KEY>with the base64 encoded string of the Certificate Key file (usually calledkey.pemordomain.key)
After replacing the values, the file should look like the example below (the base64 encoded strings should be different):
Note: The base64 encoded string should be on the same line as
tls.crtortls.key, without any newline at the beginning, in between or at the end.
---
apiVersion: v1
kind: Secret
metadata:
name: cattle-keys-ingress
namespace: cattle-system
type: Opaque
data:
tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM1RENDQWN5Z0F3SUJBZ0lKQUlHc25NeG1LeGxLTUEwR0NTcUdTSWIzRFFFQkN3VUFNQkl4RURBT0JnTlYKQkFNTUIzUmxjM1F0WTJFd0hoY05NVGd3TlRBMk1qRXdOREE1V2hjTk1UZ3dOekExTWpFd05EQTVXakFXTVJRdwpFZ1lEVlFRRERBdG9ZUzV5Ym1Ob2NpNXViRENDQVNJd0RRWUpLb1pJaHZjTkFRRUJCUUFEZ2dFUEFEQ0NBUW9DCmdnRUJBTFJlMXdzekZSb2Rib2pZV05DSHA3UkdJaUVIMENDZ1F2MmdMRXNkUUNKZlcrUFEvVjM0NnQ3bSs3TFEKZXJaV3ZZMWpuY2VuWU5JSGRBU0VnU0ducWExYnhUSU9FaE0zQXpib3B0WDhjSW1OSGZoQlZETGdiTEYzUk0xaQpPM1JLTGdIS2tYSTMxZndjbU9zWGUwaElYQnpUbmxnM20vUzlXL3NTc0l1dDVwNENDUWV3TWlpWFhuUElKb21lCmpkS3VjSHFnMTlzd0YvcGVUalZrcVpuMkJHazZRaWFpMU41bld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3VMQVhGY3lJcW5SZnoxczVzN3RMTzJCagozTFZNUVBzazFNY25oTTl4WE4vQ3ZDTys5b2t0RnNaMGJqWFh6NEJ5V2lFNHJPS1lhVEFwcDVsWlpUT3ZVMWNyCm05R3NwMWJoVDVZb2RaZ3IwUHQyYzR4U2krUVlEWnNFb2lFdzNkc0NnWUVBcVJLYWNweWZKSXlMZEJjZ0JycGkKQTRFalVLMWZsSjR3enNjbGFKUDVoM1NjZUFCejQzRU1YT0kvSXAwMFJsY3N6em83N3cyMmpud09mOEJSM0RBMwp6ZTRSWDIydWw4b0hGdldvdUZOTTNOZjNaNExuYXpVc0F0UGhNS2hRWGMrcEFBWGthUDJkZzZ0TU5PazFxaUNHCndvU212a1BVVE84b1ViRTB1NFZ4ZmZFQ2dZQUpPdDNROVNadUlIMFpSSitIV095enlOQTRaUEkvUkhwN0RXS1QKajVFS2Y5VnR1OVMxY1RyOTJLVVhITXlOUTNrSjg2OUZPMnMvWk85OGg5THptQ2hDTjhkOWN6enI5SnJPNUFMTApqWEtBcVFIUlpLTFgrK0ZRcXZVVlE3cTlpaHQyMEZPb3E5OE5SZDMzSGYxUzZUWDNHZ3RWQ21YSml6dDAxQ3ZHCmR4VnVnd0tCZ0M2Mlp0b0RLb3JyT2hvdTBPelprK2YwQS9rNDJBOENiL29VMGpwSzZtdmxEWmNYdUF1QVZTVXIKNXJCZjRVYmdVYndqa1ZWSFR6LzdDb1BWSjUvVUxJWk1Db1RUNFprNTZXWDk4ZE93Q3VTVFpZYnlBbDZNS1BBZApTZEpuVVIraEpnSVFDVGJ4K1dzYnh2d0FkbWErWUhtaVlPRzZhSklXMXdSd1VGOURLUEhHCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==
8. Configure FQDN
There are two references to <FQDN> in the config file (one in this step and one in the next). Both need to be replaced with the FQDN chosen in Configure DNS.
In the kind: Ingress with name: cattle-ingress-http:
- Replace
<FQDN>with the FQDN chosen in Configure DNS.
After replacing <FQDN> with the FQDN chosen in Configure DNS, the file should look like the example below (rancher.yourdomain.com is the FQDN used in this example):
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
namespace: cattle-system
name: cattle-ingress-http
annotations:
nginx.ingress.kubernetes.io/proxy-connect-timeout: "30"
nginx.ingress.kubernetes.io/proxy-read-timeout: "1800" # Max time in seconds for ws to remain shell window open
nginx.ingress.kubernetes.io/proxy-send-timeout: "1800" # Max time in seconds for ws to remain shell window open
spec:
rules:
- host: rancher.yourdomain.com
http:
paths:
- backend:
serviceName: cattle-service
servicePort: 80
tls:
- secretName: cattle-keys-ingress
hosts:
- rancher.yourdomain.com
Save the .yml file and close it.
9. Configure Rancher version
The last reference that needs to be replaced is <RANCHER_VERSION>. This needs to be replaced with a Rancher version which is marked as stable. The latest stable release of Rancher can be found in the GitHub README. Make sure the version is an actual version number, and not a named tag like stable or latest. The example below shows the version configured to v2.0.6.
spec:
serviceAccountName: cattle-admin
containers:
- image: rancher/rancher:v2.0.6
imagePullPolicy: Always
10. Back Up Your RKE Config File
After you close your .yml file, back it up to a secure location. You can use this file again when it's time to upgrade Rancher.
11. Run RKE
With all configuration in place, use RKE to launch Rancher. You can complete this action by running the rke up command and using the --config parameter to point toward your config file.
-
From your workstation, make sure
rancher-cluster.ymland the downloadedrkebinary are in the same directory. -
Open a Terminal instance. Change to the directory that contains your config file and
rke. -
Enter one of the
rke upcommands listen below.
rke up --config rancher-cluster.yml
Step Result: The output should be similar to the snippet below:
INFO[0000] Building Kubernetes cluster
INFO[0000] [dialer] Setup tunnel for host [1.1.1.1]
INFO[0000] [network] Deploying port listener containers
INFO[0000] [network] Pulling image [alpine:latest] on host [1.1.1.1]
...
INFO[0101] Finished building Kubernetes cluster successfully
12. Back Up Auto-Generated Config File
During installation, RKE automatically generates a config file named kube_config_rancher-cluster.yml in the same directory as the RKE binary. Copy this file and back it up to a safe location. You'll use this file later when upgrading Rancher Server.
What's Next?
You have a couple of options:
- Create a backup of your Rancher Server in case of a disaster scenario: High Availability Back Up and Restore.
- Create a Kubernetes cluster: Provisioning Kubernetes Clusters.