First, you need grant this script to executable with commands:
```bash
chmod ug+x freeleaps-cluster-authenticator
```
Now, you can get help text with commands:
```bash
freeleaps-cluster-authenticator -h
```
`Freeleaps Cluster Authentication` requires some tools to ensure authentication workflow, please check belows and make sure they are installed on your device:
-`curl`
-`unzip`
-`uname`
-`jq`
Once the required tools are installed, you can using command:
```bash
freeleaps-cluster-authenticator auth
```
to start authentication workflow.
Once authentication workflow started, `Freeleaps Cluster Authenticator` will check the requirements and automatically install `kubectl` and `kubelogin` if not found.
The console output should be like:
```text
[GATHER] Checking OS and architecture...
[INFO] OS: linux
[INFO] Architecture: amd64
[PREREQUISITES] Checking for required tools...
[PREREQUISITES] curl: ✓
[PREREQUISITES] unzip: ✓
[PREREQUISITES] uname: ✓
[PREREQUISITES] kubectl: ✓
[PREREQUISITES] kubelogin: ✓
[PREREQUISITES] jq: ✓
```
And will shows `[SETUP] Setting up kubelogin...` if prerequisites checking passed.
Now you can open `http://127.0.0.1:8000` with your browser, it will redirect to Microsoft login page, you can login `Freeleaps Kubernetes Cluster` with your `mathmast.com` Azure Directory account.
Console will shows `[SETUP] kubelogin setup completed successfully.` when authenticated successfully.
Now the `Freeleaps Cluster Authenticator` will prompt you to input your `mathmast` Azure Directory account name (ends with `@mathmast.com`):
```text
[GATHER] Checking OS and architecture...
[INFO] OS: linux
[INFO] Architecture: amd64
[PREREQUISITES] Checking for required tools...
[PREREQUISITES] curl: ✓
[PREREQUISITES] unzip: ✓
[PREREQUISITES] uname: ✓
[PREREQUISITES] kubectl: ✓
[PREREQUISITES] kubelogin: ✓
[PREREQUISITES] jq: ✓
[SETUP] Setting up kubelogin...
[SETUP] kubelogin setup completed successfully.
[PROMPT] Please enter your Mathmast account name (ending with @mathmast.com, eg. jack@mathmast.com):
```
You can enter your `mathmast.com` Azure Directory account name and press enter to submit.
The `Freeleaps Cluster Authenticator` will automatically finish setting works when you submit your `mathmast.com` Azure Directory account name and the console should be like:
```text
[PROMPT] Username: zhenyus@mathmast.com
[KUBECTL & KUBE_LOGIN] Setting kubectl credentials for zhenyus@mathmast.com...
[KUBECTL & KUBE_LOGIN] Credentials set successfully.
[KUBECTL] Adding cluster (named to: freeleaps-cluster) to kubectl...
[KUBECTL] Cluster added to kubectl successfully.
[KUBECTL] Creating kubectl context...
[KUBECTL] Context created successfully.
[KUBECTL] Using kubectl context...
[KUBECTL] Context set successfully.
[KUBECTL] Checking whoami...
ATTRIBUTE VALUE
Username zhenyus@mathmast.com
Groups [mathmast:admin system:authenticated]
[INFO] Your kubectl has been authenticated with your Mathmast account.
[INFO] Now you can try to using kubectl to interact with the cluster.
```
Now you are already finished authentication for `Freeleaps Kubernetes Cluster`.
You can using `kubectl` to work with `Freeleaps Kubernetes CLuster` right now.
Here are some useful tips for working with the Freeleaps Cluster Toolchains:
**[Jenkins](https://jenkins.mathmast.com/) and [Grafana](https://grafana.mathmast.com/) Accounts and Passwords**: You can obtain Jenkins and Grafana accounts and passwords by executing the follow command.
```
infra-auth-retriver grafana
```
**[Argo](https://argo.mathmast.com/) Account and Password**: You can obtain Argo account and password by executing the follow command.