fix and standardize code blocks in install section

This commit is contained in:
James Oliver
2018-08-23 23:24:15 -07:00
committed by Denise
parent 50521c6080
commit 48c4bc6070
8 changed files with 92 additions and 78 deletions
@@ -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 <registry.yourdomain.com:port>/$IMAGE
docker push <registry.yourdomain.com:port>/$IMAGE
done
docker tag $IMAGE <registry.yourdomain.com:port>/$IMAGE
docker push <registry.yourdomain.com:port>/$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 \
<registry.yourdomain.com:port>/rancher/rancher:latest
docker run -d --restart=unless-stopped \
-p 80:80 -p 443:443 \
<registry.yourdomain.com:port>/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=<registry.yourdomain.com:port> <registry.yourdomain.com:port>/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=<registry.yourdomain.com:port> \
<registry.yourdomain.com:port>/rancher/rancher:v2.0.0
```
@@ -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
@@ -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
@@ -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.
@@ -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=<email>
--docker-server="reg.example.com:5000" \
--docker-email=<email>
```
#### Registry Options
@@ -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
```
@@ -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/<CERT_DIRECTORY>/<FULL_CHAIN.pem>:/etc/rancher/ssl/cert.pem \
-v /etc/<CERT_DIRECTORY>/<PRIVATE_KEY.pem>:/etc/rancher/ssl/key.pem \
-v /etc/<CERT_DIRECTORY>/<CA_CERTS.pem>:/etc/rancher/ssl/cacerts.pem \
rancher/rancher:latest
```
```
docker run -d --restart=unless-stopped \
-p 80:80 -p 443:443 \
-v /etc/<CERT_DIRECTORY>/<FULL_CHAIN.pem>:/etc/rancher/ssl/cert.pem \
-v /etc/<CERT_DIRECTORY>/<PRIVATE_KEY.pem>:/etc/rancher/ssl/key.pem \
-v /etc/<CERT_DIRECTORY>/<CA_CERTS.pem>:/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/).
@@ -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