# SRE Scripts

|name|usage|example|
|:---:|:---:|:---:|
|nsenter-node.sh| get a root shell of the node by running a privileged Pod on it, only works when node and kube-apiserver is healthy | `./nsenter-node.sh <k8s-node-name>` |
|request-aws-quota.sh| request our preferred quota in a region | `REGION=us-west-2 ./request-aws-quota.sh
` |
|[cockpit.sh](#cockpit)| run a cockpit in base to control the whole infra | `./cockpit.sh staging aylei
` |

## Cockpit

Example:

```bash
# search and use context via region, tenant id or shoot name
> kc
# search and set default namespace
> kn
# update all kubeconfig
> /entrypoint.sh
# assume to full-manager-service-role
> export AWS_PROFILE=dbaas-dev
# ssh node
> /sshnode.sh {node_name}
```

Develop:

replace entrypint to bash
```bash
kubectl run -n nightly-ms tmp --restart=Never -it --image gcr.io/pingcap-public/cockpit:latest --overrides '{"spec": {"serviceAccountName": "central"}}' --command -- bash
./entrypoint.sh
```

modify ./cockpit/entrypoint.sh file in local then copy it to container
```bash
kubectl cp ./cockpit/entrypoint.sh tmp:/
```