# How to Ops

## Init runners in new cluster

### 1. Controllers installation

Install controllers: [try isolate harbor & vendor images · tidbcloud/docker\-image\-controller@7550647](https://github.com/tidbcloud/docker-image-controller/actions/runs/6821596453/job/18552242532)

### 2. Prepare needed Credentials

1. Download GCP SA JWT json file from `GCP/IAM/Service Account` service
2. Create Secret for credential of GCP

```shell
SA_FILE=${file path of previous step}
# Values you may change:
## gcp-jwt: the secret name
## actions-runner-system: namespace of runner
kubectl create secret generic gcp-jwt --from-file=gcp-jwt=${SA_FILE} --dry-run=client -o yaml | kubectl apply -n actions-runner-system -f  -
```

3. Create Image Pull Secret which may be used to pull images used by runners from gcr

```shell
SA_FILE=${file path of previous step}
kubectl create secret docker-registry gcr-json-key \
--docker-server=gcr.io \
# _json_key is fixed value if you are using GCR
--docker-username=_json_key \
--docker-password="$(cat ${SA_FILE})" \
# You can use any formated email address, like tidbcloud-bot@pingcap.com
--docker-email=${any email} -n actions-runner-system
```

### 3. Modify Deployment Yaml

If you changed any keys at above steps, remember to modify `tidbcloud-runners.yaml` before applying.

### 4. Apply Deployment

```shell
kubectl apply -f tidbcloud-runners.yaml -n actions-runner-system
```
