# Install YaK on Rancher Desktop

## Prereq: Install Rancher desktop

<https://docs.rancherdesktop.io/getting-started/installation>

## Install YaK <a href="#user-content-install-yak" id="user-content-install-yak"></a>

### 1. Go to Cluster Dashboard <a href="#user-content-1-go-to-cluster-dashboard" id="user-content-1-go-to-cluster-dashboard"></a>

<figure><img src="https://1298792519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7dKt4OHAMMapO4XybPJ8%2Fuploads%2Fgit-blob-a26791822fb90ca40b9cbd95467275d806d0fadf%2Francher_desktop_1.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1298792519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7dKt4OHAMMapO4XybPJ8%2Fuploads%2Fgit-blob-0a516dc913519e26ee2e4e80d7515c25c7867382%2Francher_desktop_2.png?alt=media" alt=""><figcaption></figcaption></figure>

### 2. Create your own yak namespace <a href="#user-content-2-create-your-own-yak-namespace" id="user-content-2-create-your-own-yak-namespace"></a>

* Go to Cluster/Namespace:

<figure><img src="https://1298792519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7dKt4OHAMMapO4XybPJ8%2Fuploads%2Fgit-blob-9fc1cbee62a0b9b93cc1455e946f81263dc65de4%2Francher_desktop_ns_1.png?alt=media" alt=""><figcaption></figcaption></figure>

* Create new namespace:

<figure><img src="https://1298792519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7dKt4OHAMMapO4XybPJ8%2Fuploads%2Fgit-blob-d2e912d3ef8fcae18dc0d1839b5accce6d1b1be3%2Francher_desktop_ns_2.png?alt=media" alt=""><figcaption></figcaption></figure>

We usually simply use "yak4all" as namespace, but feel free to be creative 😄

<figure><img src="https://1298792519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7dKt4OHAMMapO4XybPJ8%2Fuploads%2Fgit-blob-75134e7231664c488d033a949ef6b835c4e4cec5%2Francher_desktop_ns_3.png?alt=media" alt=""><figcaption></figcaption></figure>

### 3. Add repository <a href="#user-content-4-add-repository" id="user-content-4-add-repository"></a>

Now from your terminal:

```bash
helm repo add yak https://gitlab.com/api/v4/projects/63133284/packages/helm/stable && helm repo update
```

### 4. Create your "yak.values.yaml" file <a href="#user-content-5-create-your-yakvaluesyaml-file" id="user-content-5-create-your-yakvaluesyaml-file"></a>

```yaml
global:
  hostname: <your_hostname>.<your_domain>
  admin_credentials:    
    password: "ABCdef1234@" #default password to be changed to your need

yak-postgres:
  postgresPassword: "" # Randomly generated if not set
  persistence:
    size: 20Gi
    storageClassName: "<your_storage_class>" # Uses default if empty

yak-graphile:
  # Archive storage stores the component types archives at import time
  persistence: &archives_storage
    size: 20Gi
    storageClassName: "<your_storage_class>" # Uses default if empty
  # If using a multi-node cluster, uncomment these 2 lines:
    #accessModes:
     # - ReadWriteMany

  # If you want to expose the rest API at https://hostname/data/graphql and have the postgraphile UI at https://yak.my-domain.local/data/graphiql
  ingress:
    enabled: true
    className: "<your_ingress_class>" # Uses default if empty
    tls:
     - secretName: yak-tls-secret
       hosts:
       - <your_hostname>.<your_domain>

yak-runner:
  image:
    pullPolicy: Always
  persistence:
  # Runner shares the archives storage with graphile
    graphile: *archives_storage
    components:
      enabled: true
      storageClassName: "<your_storage_class>" # Uses default if empty
      size: 8Gi
    sshconfig:
      enabled: true
      storageClassName: "<your_storage_class>" # Uses default if empty
      size: 1Gi

yak-ui:
  # Mandatory if you want to access the UI through ingress
  ingress:
    enabled: true
    className: "<your_ingress_class>" # Uses default if empty
    tls:
     - secretName: yak-tls-secret
       hosts:
       - <your_hostname>.<your_domain>

```

* Replace `"<your_hostname>.<your_domain>"` in the yaml file with your actual hostname
  * ex : yak.my-domain.com
* Replace `"<your_storage_class>"`in the yaml file with your actual storage class name
  * It will use the default storage class if left empty
  * You can list your storage classes using `kubectl get sc` if needed.
* Replace `"<your_ingress_class>"` in the yaml file with your actual ingress class name
  * If left empty, it will use the default ingress class [if you have one configured as default](https://kubernetes.io/docs/concepts/services-networking/ingress/#default-ingress-class)
  * You can list your ingress classes using `kubectl get ingressclasses` if needed.
* Save the file as "yak.values.yaml"

### 5. Create your TLS secret

Optionally, for testing purpose, you can generate a self signed certificate with the following command.

```bash
openssl req -x509 -newkey rsa:2048 -keyout <key-filepath>.key -out <cert-filepath>.pem -days 365 -nodes
```

For the Ingress TLS configuration, use your certificate and create the following Kubernetes secret.

```bash
kubectl create secret tls yak-tls-secret -n <namespace> --cert=<cert-filepath>.pem --key=<key-filepath>.key
```

### 6. Install YaK <a href="#user-content-6-install-yak" id="user-content-6-install-yak"></a>

```
helm install yak yak/yak -f yak.values.yaml -n <namespace>
```

### 7. Check that YaK is properly deployed <a href="#user-content-7-check-that-yak-is-properly-deployed" id="user-content-7-check-that-yak-is-properly-deployed"></a>

* Go to Workload/Pods, you should see 4 running pods:

<figure><img src="https://1298792519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7dKt4OHAMMapO4XybPJ8%2Fuploads%2Fgit-blob-27be80e5fc8c4d0964b56946e151576b1750fee2%2Francher_desktop_pods_1.png?alt=media" alt=""><figcaption></figcaption></figure>

### 8. Connect to the YaK with https <a href="#user-content-connect-to-the-yak-with-https" id="user-content-connect-to-the-yak-with-https"></a>

* https\://\<your\_hostname>.\<your\_domain>
* Default credentials :
  * Login: admin
  * Password: ABCdef1234@

<figure><img src="https://1298792519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7dKt4OHAMMapO4XybPJ8%2Fuploads%2Fgit-blob-65fdf4a6fb005875ce953d676007f16dd399fc33%2Francher_desktop_login_1.png?alt=media" alt=""><figcaption></figcaption></figure>

If using Rancher Desktop for a local installation of your YaK (on a laptop and for testing purpose for example), you may need to update your hosts file (/etc/hosts) and add this line:

```
127.0.0.1    <your_hostname>.<your_domain>
```
