|
| 1 | +--- |
| 2 | +sidebar_position: 2 |
| 3 | +--- |
| 4 | +# Setup |
| 5 | +If it's your first time accessing the infrastructure, you'll need to setup the tools and configure them. |
| 6 | + |
| 7 | +:::caution |
| 8 | +This tutorial assumes your account has the right permissions to access the infrastructure. If not, please contact the team. |
| 9 | +::: |
| 10 | + |
| 11 | +## Azure CLI & Kubectl |
| 12 | + |
| 13 | +- Download and install Kubectl [here](https://kubernetes.io/docs/tasks/tools/install-kubectl/). |
| 14 | + |
| 15 | +- Download and install the Azure CLI [here](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest). |
| 16 | + |
| 17 | +- Run ```az login``` to login. |
| 18 | + |
| 19 | +- Run ```az aks get-credentials --resource-group rg-polinetwork --name aks-polinetwork``` to configure Kubectl. |
| 20 | + |
| 21 | +- To check if everything is working, run ```kubectl get pods -n <namespace>```. You should see a list of pods. |
| 22 | + |
| 23 | +:::info |
| 24 | +The possible values of ```<namespace>``` may vary depending on the project you're working on. If you're not sure, ask the team. |
| 25 | +::: |
| 26 | + |
| 27 | +:::danger |
| 28 | +Starting from Kubectl v1.26, the Azure auth plugin has been removed. If you're using a new version, you'll need to install and run [kubelogin](https://github.com/Azure/kubelogin#setup). Then run ```kubectl get pods -n <namespace>``` again. |
| 29 | +::: |
| 30 | + |
| 31 | + |
| 32 | +## Port Forwarding |
| 33 | +To access services running on the cluster (such as the MariaDB database), you'll need to forward the correct ports. To do so, we need the correct pod name. |
| 34 | + |
| 35 | +- Run ```kubectl get pods -n <namespace>``` to get the pod name. The pod name is listed under the ```NAME``` column. |
| 36 | + |
| 37 | +- Run ```kubectl port-forward <pod-name> <local-port>:<remote-port> -n <namespace>``` |
| 38 | +For example, if you want to access the MariaDB database, you'll need to run |
| 39 | +``` |
| 40 | +kubectl port-forward <pod-name> 3306:3306 -n <namespace> |
| 41 | +``` |
| 42 | + |
| 43 | +:::tip |
| 44 | +If you're using the MariaDB database, you can use the following command to get the pod name and forward the port in one go: |
| 45 | +``` |
| 46 | +PODNAME=$(kubectl get pods --no-headers -n mariadb -o custom-columns=":metadata.name" | tail -1); kubectl port-forward -n mariadb $PODNAME 3306:3306 |
| 47 | +``` |
| 48 | +You can use the same template to connect to other services. |
| 49 | +::: |
0 commit comments