From 48c4bc60709a44b50e7963dd87a177bc656bff99 Mon Sep 17 00:00:00 2001 From: James Oliver Date: Thu, 23 Aug 2018 19:34:15 -0700 Subject: [PATCH] fix and standardize code blocks in install section --- .../air-gap-installation/_index.md | 37 ++++++------ .../en/installation/api-auditing/_index.md | 18 +++--- .../en/installation/ha/helm-init/_index.md | 4 +- .../en/installation/ha/helm-rancher/_index.md | 28 ++++++---- .../ha/helm-rancher/chart-options/_index.md | 4 +- .../ha/helm-rancher/tls-secrets/_index.md | 7 ++- .../en/installation/single-node/_index.md | 56 +++++++++---------- .../single-node-install-external-lb/_index.md | 16 +++--- 8 files changed, 92 insertions(+), 78 deletions(-) diff --git a/content/rancher/v2.x/en/installation/air-gap-installation/_index.md b/content/rancher/v2.x/en/installation/air-gap-installation/_index.md index 558b5664dc5..c3fdaea503a 100644 --- a/content/rancher/v2.x/en/installation/air-gap-installation/_index.md +++ b/content/rancher/v2.x/en/installation/air-gap-installation/_index.md @@ -40,18 +40,17 @@ We will cover two scenarios: 1. Browse to the release page of your version (i.e. `https://github.com/rancher/rancher/releases/tag/v2.0.0`) and download `rancher-images.txt` 2. Pull all the images present in `rancher-images.txt`, re-tag each image with the location of your registry, and push the image to the registry. This will require at least 20GB of disk space. See an example script below: - - ``` -#!/bin/sh -IMAGES=`curl -s -L https://github.com/rancher/rancher/releases/download/v2.0.0/rancher-images.txt` -for IMAGE in $IMAGES; do - until docker inspect $IMAGE > /dev/null 2>&1; do + ``` + #!/bin/sh + IMAGES=`curl -s -L https://github.com/rancher/rancher/releases/download/v2.0.0/rancher-images.txt` + for IMAGE in $IMAGES; do + until docker inspect $IMAGE > /dev/null 2>&1; do docker pull $IMAGE + done + docker tag $IMAGE /$IMAGE + docker push /$IMAGE done - docker tag $IMAGE /$IMAGE - docker push /$IMAGE -done - ``` + ``` ## Completing the Rancher installation @@ -66,9 +65,9 @@ Complete installation of Rancher using the instructions in [Single Node Install] > > Example: > ``` - docker run -d --restart=unless-stopped \ - -p 80:80 -p 443:443 \ - /rancher/rancher:latest +docker run -d --restart=unless-stopped \ + -p 80:80 -p 443:443 \ + /rancher/rancher:latest ``` ## Configuring Rancher to use the private registry @@ -83,8 +82,12 @@ Rancher needs to be configured to use the private registry as source for the nee ![Save]({{< baseurl >}}/img/rancher/airgap/enter-system-default-registry.png) ->**Note:** If you want to configure the setting when starting the rancher/rancher container, you can use the environment variable `CATTLE_SYSTEM_DEFAULT_REGISTRY`. Example: -``` -#!/bin/sh -docker run -d -p 80:80 -p 443:443 -e CATTLE_SYSTEM_DEFAULT_REGISTRY= /rancher/rancher:v2.0.0 +>**Note:** If you want to configure the setting when starting the rancher/rancher container, you can use the environment variable `CATTLE_SYSTEM_DEFAULT_REGISTRY`. +> +> Example: +> ``` +docker run -d --restart=unless-stopped \ + -p 80:80 -p 443:443 \ + -e CATTLE_SYSTEM_DEFAULT_REGISTRY= \ + /rancher/rancher:v2.0.0 ``` diff --git a/content/rancher/v2.x/en/installation/api-auditing/_index.md b/content/rancher/v2.x/en/installation/api-auditing/_index.md index e20747d0897..60c95c05b44 100644 --- a/content/rancher/v2.x/en/installation/api-auditing/_index.md +++ b/content/rancher/v2.x/en/installation/api-auditing/_index.md @@ -38,15 +38,15 @@ To enable API auditing, stop the Docker container that's running Rancher, and th ``` - docker run -d --restart=unless-stopped \ - -p 80:80 -p 443:443 \ - -v /root/var/log/auditlog:/var/log/auditlog \ - -e AUDIT_LEVEL=1 \ - -e AUDIT_LOG_PATH=/var/log/auditlog/rancher-api-audit.log \ - -e AUDIT_LOG_MAXAGE=20 \ - -e AUDIT_LOG_MAXBACKUP=20 \ - -e AUDIT_LOG_MAXSIZE=100 \ - rancher/rancher:latest +docker run -d --restart=unless-stopped \ + -p 80:80 -p 443:443 \ + -v /root/var/log/auditlog:/var/log/auditlog \ + -e AUDIT_LEVEL=1 \ + -e AUDIT_LOG_PATH=/var/log/auditlog/rancher-api-audit.log \ + -e AUDIT_LOG_MAXAGE=20 \ + -e AUDIT_LOG_MAXBACKUP=20 \ + -e AUDIT_LOG_MAXSIZE=100 \ + rancher/rancher:latest ``` ## Viewing API Audit Logs diff --git a/content/rancher/v2.x/en/installation/ha/helm-init/_index.md b/content/rancher/v2.x/en/installation/ha/helm-init/_index.md index bc447a1320d..245775e475c 100644 --- a/content/rancher/v2.x/en/installation/ha/helm-init/_index.md +++ b/content/rancher/v2.x/en/installation/ha/helm-init/_index.md @@ -15,7 +15,9 @@ Helm installs the `tiller` service on your cluster to manage charts. Since RKE e ``` kubectl -n kube-system create serviceaccount tiller -kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller +kubectl create clusterrolebinding tiller \ + --clusterrole cluster-admin \ + --serviceaccount=kube-system:tiller ``` ##### Helm init diff --git a/content/rancher/v2.x/en/installation/ha/helm-rancher/_index.md b/content/rancher/v2.x/en/installation/ha/helm-rancher/_index.md index 619fbae7a62..57fd70024ae 100644 --- a/content/rancher/v2.x/en/installation/ha/helm-rancher/_index.md +++ b/content/rancher/v2.x/en/installation/ha/helm-rancher/_index.md @@ -22,7 +22,9 @@ Rancher relies on [cert-manager](https://github.com/kubernetes/charts/tree/maste Install `cert-manager` from the Helm stable catalog. ``` -helm install stable/cert-manager --name cert-manager --namespace kube-system +helm install stable/cert-manager \ + --name cert-manager \ + --namespace kube-system ``` ### Choose your SSL Configuration @@ -44,8 +46,10 @@ The default is for Rancher to generate a CA and use the `cert-manager` to issue The only requirement is to set the `hostname` to the DNS name you pointed at your Load Balancer. ``` -helm install rancher-stable/rancher --name rancher --namespace cattle-system \ ---set hostname=rancher.my.org +helm install rancher-stable/rancher \ + --name rancher \ + --namespace cattle-system \ + --set hostname=rancher.my.org ``` #### LetsEncrypt @@ -55,10 +59,12 @@ Use [LetsEncrypt](https://letsencrypt.org/)'s free service to issue trusted SSL Set `hostname`, `ingress.tls.source=letEncrypt` and LetsEncrypt options. ``` -helm install rancher-stable/rancher --name rancher --namespace cattle-system \ ---set hostname=rancher.my.org \ ---set ingress.tls.source=letsEncrypt \ ---set letsEncrypt.email=me@example.org +helm install rancher-stable/rancher \ + --name rancher \ + --namespace cattle-system \ + --set hostname=rancher.my.org \ + --set ingress.tls.source=letsEncrypt \ + --set letsEncrypt.email=me@example.org ``` #### Certificates from Files (Kubernetes Secret) @@ -72,9 +78,11 @@ Set `hostname` and `ingress.tls.source=secret` > NOTE: If you are using a Private CA signed cert, add `--set privateCA=true` ``` -helm install rancher-stable/rancher --name rancher --namespace cattle-system \ ---set hostname=rancher.my.org \ ---set ingress.tls.source=secret +helm install rancher-stable/rancher \ + --name rancher \ + --namespace cattle-system \ + --set hostname=rancher.my.org \ + --set ingress.tls.source=secret ``` Now that Rancher is running, see [Adding TLS Secrets]({{< baseurl >}}/rancher/v2.x/en/installation/ha/helm-rancher/tls-secrets/) to publish the certificate files so Rancher and the Ingress Controller can use them. diff --git a/content/rancher/v2.x/en/installation/ha/helm-rancher/chart-options/_index.md b/content/rancher/v2.x/en/installation/ha/helm-rancher/chart-options/_index.md index 2b338442f90..f31c8c02a6c 100644 --- a/content/rancher/v2.x/en/installation/ha/helm-rancher/chart-options/_index.md +++ b/content/rancher/v2.x/en/installation/ha/helm-rancher/chart-options/_index.md @@ -57,8 +57,8 @@ Use `kubectl` to create a docker-registry secret in the `cattle-system` namespac ``` kubectl -n cattle-system create secret docker-registry regcred \ ---docker-server="reg.example.com:5000" \ ---docker-email= + --docker-server="reg.example.com:5000" \ + --docker-email= ``` #### Registry Options diff --git a/content/rancher/v2.x/en/installation/ha/helm-rancher/tls-secrets/_index.md b/content/rancher/v2.x/en/installation/ha/helm-rancher/tls-secrets/_index.md index b77e4e1e9ba..fa2e65fe889 100644 --- a/content/rancher/v2.x/en/installation/ha/helm-rancher/tls-secrets/_index.md +++ b/content/rancher/v2.x/en/installation/ha/helm-rancher/tls-secrets/_index.md @@ -11,8 +11,8 @@ Use `kubectl` with the `tls` secret type to create the secrets. ``` kubectl -n cattle-system create secret tls tls-rancher-ingress \ ---cert=./tls.crt \ ---key=./tls.key + --cert=./tls.crt \ + --key=./tls.key ``` ### Private CA Signed - Additional Steps @@ -22,5 +22,6 @@ If you are using a private CA, Rancher will need to have a copy of the CA cert t Copy the CA cert into a file named `cacerts.pem` and use `kubectl` to create the `tls-ca` secret in the `cattle-system` namespace. ``` -kubectl -n cattle-system create secret generic tls-ca --from-file=cacerts.pem +kubectl -n cattle-system create secret generic tls-ca \ + --from-file=cacerts.pem ``` diff --git a/content/rancher/v2.x/en/installation/single-node/_index.md b/content/rancher/v2.x/en/installation/single-node/_index.md index 47c3d7a2da9..ad994a1e8e1 100644 --- a/content/rancher/v2.x/en/installation/single-node/_index.md +++ b/content/rancher/v2.x/en/installation/single-node/_index.md @@ -16,11 +16,11 @@ Installation of Rancher on a single node involves multiple procedures. Review th 1. [Provision Linux Host](#1-provision-linux-host) - Provision a single Linux host to launch your {{< product >}} Server. + Provision a single Linux host to launch your {{< product >}} Server. 2. [Choose an SSL Option and Install Rancher](#2-choose-an-ssl-option-and-install-rancher) - Choose an SSL option for Rancher communication encryption. After choosing an option, run the command that accompanies it to deploy Rancher. + Choose an SSL option for Rancher communication encryption. After choosing an option, run the command that accompanies it to deploy Rancher. ## 1. Provision Linux Host @@ -87,11 +87,11 @@ If you install Rancher without using your own certificate, Rancher generates a s 1. From your Linux host, run the Docker command to install Rancher without any additional parameters: - ``` - docker run -d --restart=unless-stopped \ - -p 80:80 -p 443:443 \ - rancher/rancher:latest - ``` + ``` + docker run -d --restart=unless-stopped \ + -p 80:80 -p 443:443 \ + rancher/rancher:latest + ``` ### Option B—Bring Your Own Certificate: Self-Signed @@ -109,14 +109,14 @@ Your Rancher install can use a self-signed certificate that you provide to encry 1. After creating your certificate, run the Docker command to install Rancher, pointing toward your certificate files. - ``` - docker run -d --restart=unless-stopped \ - -p 80:80 -p 443:443 \ - -v /etc//:/etc/rancher/ssl/cert.pem \ - -v /etc//:/etc/rancher/ssl/key.pem \ - -v /etc//:/etc/rancher/ssl/cacerts.pem \ - rancher/rancher:latest - ``` + ``` + docker run -d --restart=unless-stopped \ + -p 80:80 -p 443:443 \ + -v /etc//:/etc/rancher/ssl/cert.pem \ + -v /etc//:/etc/rancher/ssl/key.pem \ + -v /etc//:/etc/rancher/ssl/cacerts.pem \ + rancher/rancher:latest + ``` ### Option C—Bring Your Own Certificate: Signed by Recognized CA @@ -132,13 +132,13 @@ If you're publishing your app publicly, you should ideally be using a certificat 1. After obtaining your certificate, run the Docker command to deploy Rancher while pointing toward your certificate files. - ``` - docker run -d --restart=unless-stopped \ - -p 80:80 -p 443:443 \ - -v /etc/your_certificate_directory/fullchain.pem:/etc/rancher/ssl/cert.pem \ - -v /etc/your_certificate_directory/privkey.pem:/etc/rancher/ssl/key.pem \ - rancher/rancher:latest --no-cacerts - ``` + ``` + docker run -d --restart=unless-stopped \ + -p 80:80 -p 443:443 \ + -v /etc/your_certificate_directory/fullchain.pem:/etc/rancher/ssl/cert.pem \ + -v /etc/your_certificate_directory/privkey.pem:/etc/rancher/ssl/key.pem \ + rancher/rancher:latest --no-cacerts + ``` ### Option D—Bring Your Own Certificate: Private CA Root Certificate @@ -188,12 +188,12 @@ Run the following commands from your Linux host. 1. Run the Docker command. - ``` - docker run -d --restart=unless-stopped \ - -p 80:80 -p 443:443 \ - rancher/rancher:latest \ - --acme-domain rancher.mydomain.com - ``` + ``` + docker run -d --restart=unless-stopped \ + -p 80:80 -p 443:443 \ + rancher/rancher:latest \ + --acme-domain rancher.mydomain.com + ``` > >**Remember:** Let's Encrypt provides rate limits for requesting new certificates. Therefore, limit how often you create or destroy the container. For more information, see [Let's Encrypt documentation on rate limits](https://letsencrypt.org/docs/rate-limits/). diff --git a/content/rancher/v2.x/en/installation/single-node/single-node-install-external-lb/_index.md b/content/rancher/v2.x/en/installation/single-node/single-node-install-external-lb/_index.md index 44b401e507d..5d6bbb04aa8 100644 --- a/content/rancher/v2.x/en/installation/single-node/single-node-install-external-lb/_index.md +++ b/content/rancher/v2.x/en/installation/single-node/single-node-install-external-lb/_index.md @@ -18,15 +18,15 @@ Installation of Rancher on a single node with an external load balancer involves 1. [Provision Linux Host](#1-provision-linux-host) - Provision a single Linux host to launch your {{< product >}} Server. + Provision a single Linux host to launch your {{< product >}} Server. 2. [Choose an SSL Option and Install Rancher](#2-choose-an-ssl-option-and-install-rancher) - Choose an SSL option for Rancher communication encryption. After choosing an option, run the command that accompanies it to deploy Rancher. + Choose an SSL option for Rancher communication encryption. After choosing an option, run the command that accompanies it to deploy Rancher. 3. [Configure Load Balancer](#3-configure-load-balancer) - Setup a load balancer to direct communications with Rancher and your Kubernetes cluster. + Setup a load balancer to direct communications with Rancher and your Kubernetes cluster. ## 1. Provision Linux Host @@ -96,9 +96,9 @@ If you elect to use a self-signed certificate to encrypt communication, you must ``` docker run -d --restart=unless-stopped \ - -p 80:80 -p 443:443 \ - -v /etc/your_certificate_directory/cacerts.pem:/etc/rancher/ssl/cacerts.pem \ - rancher/rancher:latest + -p 80:80 -p 443:443 \ + -v /etc/your_certificate_directory/cacerts.pem:/etc/rancher/ssl/cacerts.pem \ + rancher/rancher:latest ``` ### Option B-Bring Your Own Certificate: Signed by Recognized CA @@ -117,8 +117,8 @@ If you use a certificate signed by a recognized CA, installing your certificate ``` docker run -d --restart=unless-stopped \ - -p 80:80 -p 443:443 \ - rancher/rancher:latest --no-cacerts + -p 80:80 -p 443:443 \ + rancher/rancher:latest --no-cacerts ``` ## 3. Configure Load Balancer