From 9c209dff4b2369985dae68a8c8eac997d94ec11b Mon Sep 17 00:00:00 2001 From: Bastian Hofmann Date: Wed, 11 Jan 2023 16:59:25 +0100 Subject: [PATCH 1/4] Expand docs to install Rancher behind HTTP Proxy to cover K3s and RKE2 Fixes https://github.com/rancher/rancher-docs/issues/368 Signed-off-by: Bastian Hofmann --- .../install-kubernetes.md | 95 ++++++++++++++++--- .../install-rancher.md | 10 +- 2 files changed, 91 insertions(+), 14 deletions(-) diff --git a/docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-kubernetes.md b/docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-kubernetes.md index 1e3783e036d..7d96b8c2fbb 100644 --- a/docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-kubernetes.md +++ b/docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-kubernetes.md @@ -2,11 +2,11 @@ title: '2. Install Kubernetes' --- -Once the infrastructure is ready, you can continue with setting up an RKE cluster to install Rancher in. +Once the infrastructure is ready, you can continue with setting up a Kubernetes cluster to install Rancher in. -First, you have to install Docker and setup the HTTP proxy on all three Linux nodes. For this perform the following steps on all three nodes. +The steps to set up RKE, RKE2, or K3s are shown below. -For convenience, export the IP address and port of your proxy into an environment variable and set up the HTTP_PROXY variables for your current shell: +For convenience, export the IP address and port of your proxy into an environment variable and set up the HTTP_PROXY variables for your current shell on every node: ``` export proxy_host="10.0.0.5:8888" @@ -15,6 +15,84 @@ export HTTPS_PROXY=http://${proxy_host} export NO_PROXY=127.0.0.0/8,10.0.0.0/8,cattle-system.svc,172.16.0.0/12,192.168.0.0/16 ``` + + + +First configure the HTTP proxy settings on the K3s systemd service, so that K3s's Containerd can pull images through the proxy: + +``` +cat <<'EOF' | sudo tee /etc/default/k3s > /dev/null +HTTP_PROXY=http://${proxy_host} +HTTPS_PROXY=http://${proxy_host}" +NO_PROXY=127.0.0.0/8,10.0.0.0/8,cattle-system.svc,172.16.0.0/12,192.168.0.0/16,.svc,.cluster.local +EOF +``` + +Then run the K3s installation script to create a new K3s cluster. Ensure that the K3s version you are installing is [supported by Rancher](https://www.suse.com/suse-rancher/support-matrix/all-supported-versions/). + +On the first node, create a new cluster: +``` +curl -sfL https://get.k3s.io | INSTALL_K3S_CHANNEL=v1.23 K3S_TOKEN=your_secret sh -s - server --cluster-init +``` + +And then join the other nodes: +``` +curl -sfL https://get.k3s.io | INSTALL_K3S_CHANNEL=v1.23 K3S_TOKEN=your_secret sh -s - server --server https://:6443 +``` + +For more information on installing K3s see the [K3s installation docs](https://docs.k3s.io/installation). + +To have a look at your cluster run: + +``` +kubectl cluster-info +kubectl get pods --all-namespaces +``` + + + + +On every node, run the RKE2 installation script. Ensure that the RKE2 version you are installing is [supported by Rancher](https://www.suse.com/suse-rancher/support-matrix/all-supported-versions/). + +``` +curl -sfL https://get.rke2.io | INSTALL_RKE2_CHANNEL=v1.23 sh - +``` + +Then you have to configure the HTTP proxy settings on the RKE2 systemd service, so that RKE2's Containerd can pull images through the proxy: + +``` +cat <<'EOF' | sudo tee /etc/default/rke2-server > /dev/null +HTTP_PROXY=http://${proxy_host} +HTTPS_PROXY=http://${proxy_host}" +NO_PROXY=127.0.0.0/8,10.0.0.0/8,cattle-system.svc,172.16.0.0/12,192.168.0.0/16,.svc,.cluster.local +EOF +``` + +Next create the RKE2 configuration file on every node following the [RKE2 High Availability documentation](https://docs.rke2.io/install/ha). + +After that start and enable the `rke2-server` service: + +``` +systemctl enable rke2-server.service +systemctl start rke2-server.service +``` + +For more information on installing RKE2 see the [RKE2 installation docs](https://docs.rke2.io/install/). + +To have a look at your cluster run: + +``` +export KUBECONFIG=/etc/rancher/rke2/rke2.yaml +alias kubectl=/var/lib/rancher/rke2/bin/kubectl +kubectl cluster-info +kubectl get pods --all-namespaces +``` + + + + +First, you have to install Docker and setup the HTTP proxy on all three Linux nodes. For this perform the following steps on all three nodes. + Next configure apt to use this proxy when installing packages. If you are not using Ubuntu, you have to adapt this step accordingly: ``` @@ -92,14 +170,6 @@ chmod +x ./kubectl sudo mv ./kubectl /usr/local/bin/kubectl ``` -* [helm](https://helm.sh/docs/intro/install/) - -``` -curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 -chmod +x get_helm.sh -sudo ./get_helm.sh -``` - Next, create a YAML file that describes the RKE cluster. Ensure that the IP addresses of the nodes and the SSH username are correct. For more information on the cluster YAML, have a look at the [RKE documentation](https://rancher.com/docs/rke/latest/en/example-yamls/). ```yml @@ -166,6 +236,9 @@ The "rancher-cluster" parts of the two latter file names are dependent on how yo ::: + + + ### Issues or errors? See the [Troubleshooting](../../install-upgrade-on-a-kubernetes-cluster/troubleshooting.md) page. diff --git a/docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-rancher.md b/docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-rancher.md index a4b901e0794..72d08692ac8 100644 --- a/docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-rancher.md +++ b/docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-rancher.md @@ -4,11 +4,15 @@ title: 3. Install Rancher Now that you have a running RKE cluster, you can install Rancher in it. For security reasons all traffic to Rancher must be encrypted with TLS. For this tutorial you are going to automatically issue a self-signed certificate through [cert-manager](https://cert-manager.io/). In a real-world use-case you will likely use Let's Encrypt or provide your own certificate. -:::note +### Install the Helm CLI -These installation instructions assume you are using Helm 3. +Install the [Helm](https://helm.sh/docs/intro/install/) CLI on a host where you have a kubeconfig to access your Kubernetes cluster: -::: +``` +curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 +chmod +x get_helm.sh +sudo ./get_helm.sh +``` ### Install cert-manager From 5f9f8023518b74a48c3ddbc8067d1068fe657367 Mon Sep 17 00:00:00 2001 From: Bastian Hofmann Date: Fri, 13 Jan 2023 10:30:23 +0100 Subject: [PATCH 2/4] Update docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-kubernetes.md Co-authored-by: Billy Tat --- .../rancher-behind-an-http-proxy/install-kubernetes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-kubernetes.md b/docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-kubernetes.md index 7d96b8c2fbb..31c6d5a1279 100644 --- a/docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-kubernetes.md +++ b/docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-kubernetes.md @@ -18,7 +18,7 @@ export NO_PROXY=127.0.0.0/8,10.0.0.0/8,cattle-system.svc,172.16.0.0/12,192.168.0 -First configure the HTTP proxy settings on the K3s systemd service, so that K3s's Containerd can pull images through the proxy: +First configure the HTTP proxy settings on the K3s systemd service, so that K3s's containerd can pull images through the proxy: ``` cat <<'EOF' | sudo tee /etc/default/k3s > /dev/null From 5168eda4707cd13df2eb80ba75684e66b4b791f2 Mon Sep 17 00:00:00 2001 From: Bastian Hofmann Date: Fri, 13 Jan 2023 10:30:28 +0100 Subject: [PATCH 3/4] Update docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-kubernetes.md Co-authored-by: Billy Tat --- .../rancher-behind-an-http-proxy/install-kubernetes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-kubernetes.md b/docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-kubernetes.md index 31c6d5a1279..9608ee3f237 100644 --- a/docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-kubernetes.md +++ b/docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-kubernetes.md @@ -58,7 +58,7 @@ On every node, run the RKE2 installation script. Ensure that the RKE2 version yo curl -sfL https://get.rke2.io | INSTALL_RKE2_CHANNEL=v1.23 sh - ``` -Then you have to configure the HTTP proxy settings on the RKE2 systemd service, so that RKE2's Containerd can pull images through the proxy: +Then you have to configure the HTTP proxy settings on the RKE2 systemd service, so that RKE2's containerd can pull images through the proxy: ``` cat <<'EOF' | sudo tee /etc/default/rke2-server > /dev/null From e4c780d16667c62c6c3e5d395b380a7010e5b613 Mon Sep 17 00:00:00 2001 From: Bastian Hofmann Date: Mon, 16 Jan 2023 10:17:29 +0100 Subject: [PATCH 4/4] Do not mention a specific Kubernetes version for Rancher, use a placeholder instead --- .../rancher-behind-an-http-proxy/install-kubernetes.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-kubernetes.md b/docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-kubernetes.md index 9608ee3f237..cd1fe0ac0f0 100644 --- a/docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-kubernetes.md +++ b/docs/getting-started/installation-and-upgrade/other-installation-methods/rancher-behind-an-http-proxy/install-kubernetes.md @@ -32,12 +32,12 @@ Then run the K3s installation script to create a new K3s cluster. Ensure that th On the first node, create a new cluster: ``` -curl -sfL https://get.k3s.io | INSTALL_K3S_CHANNEL=v1.23 K3S_TOKEN=your_secret sh -s - server --cluster-init +curl -sfL https://get.k3s.io | INSTALL_K3S_CHANNEL=v1.xx K3S_TOKEN=your_secret sh -s - server --cluster-init ``` And then join the other nodes: ``` -curl -sfL https://get.k3s.io | INSTALL_K3S_CHANNEL=v1.23 K3S_TOKEN=your_secret sh -s - server --server https://:6443 +curl -sfL https://get.k3s.io | INSTALL_K3S_CHANNEL=v1.xx K3S_TOKEN=your_secret sh -s - server --server https://:6443 ``` For more information on installing K3s see the [K3s installation docs](https://docs.k3s.io/installation). @@ -55,7 +55,7 @@ kubectl get pods --all-namespaces On every node, run the RKE2 installation script. Ensure that the RKE2 version you are installing is [supported by Rancher](https://www.suse.com/suse-rancher/support-matrix/all-supported-versions/). ``` -curl -sfL https://get.rke2.io | INSTALL_RKE2_CHANNEL=v1.23 sh - +curl -sfL https://get.rke2.io | INSTALL_RKE2_CHANNEL=v1.xx sh - ``` Then you have to configure the HTTP proxy settings on the RKE2 systemd service, so that RKE2's containerd can pull images through the proxy: