# Rancher installation guide

## Install on localhost

### Kubectl

#### Debian based systems:

1. Update the <mark style="color:green;">`apt`</mark> package index and install packages needed to use the Kubernetes <mark style="color:green;">`apt`</mark> <mark style="color:green;"></mark><mark style="color:green;">repository</mark>

```bash
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
```

2\. Download the Google Cloud public signing key

```bash
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
```

3\. Add the Kubernetes <mark style="color:green;">`apt`</mark> repository

```bash
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
```

4\. Update and install

```bash
sudo apt-get update
sudo apt-get install -y kubectl
```

#### RHEL based systtems:

```bash
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
yum install -y kubectl
```

### Helm

1. Install helm

```bash
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
```

2\. Add repo

```bash
helm repo add rancher-stable https://releases.rancher.com/server-charts/stable
```

3\. Create Rancher namespace

```bash
kubectl create namespace cattle-system
```

### Cert Manager

1. Install Cert Manager

```bash
kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v1.2.0/cert-manager.crds.yaml
```

2\. Create Namespace

```bash
kubectl create namespace cert-manager
```

3\. Add Jetstack Helm repo

```bash
helm repo add jetstack https://charts.jetstack.io
```

4\. Update repo

```bash
helm repo update
```

## Resources:

* [Official Documentation](https://rancher.com/docs/k3s/latest/en/installation/installation-requirements/)
* [High Availability with an External DB](https://rancher.com/docs/k3s/latest/en/installation/ha/#1-create-an-external-datastore)
* [Cluster Datastore Options](https://rancher.com/docs/k3s/latest/en/installation/datastore/)
* [Youtube Installation Guide](https://www.youtube.com/watch?v=APsZJbnluXg)
