Command Line Access
Alokai Cloud is a hosting solution based on Kubernetes. Kubernetes has a powerful command-line tool kubectl. You can use it to explore and troubleshoot services in your Alokai Cloud instance. To get the kube.config for your instance see the section below.
You cannot edit instance configuration using kubectl
. Access is limited only to listing replicasets and pod objects, printing the pod logs and logging in to containers. Check Available actions section for examples.
Getting kube.config
Download a kube.config for the instance yourself by performing a curl request:
curl -H "X-User-Id: $VSFC_USER_ID" \
-H "X-Api-Key: $VSFC_API_KEY" \
-H 'Content-Type: application/json' \
-X GET https://farmer.storefrontcloud.io/instance/<your-instance-name>/kube_config > <your-instance-name>.kubeconfig
This will fetch the configuration and save it to the <your-instance-name>.kubeconfig file. You can then use it to access the instance on the cluster. The credentials that kubeconfig uses are temporary. After token expiration (30 days) it is necessary to fetch a new kubeconfing file. Kubeconfig should not be shared with third parties.
Configuring kubectl to use kube.config file
You can communicate with your instance as shown below:
kubectl --namespace <your-instance-name> get pods --kubeconfig <path/to/the/kube.config>
However, you will have to specify the path to kube.config file each time you communicate with api. To make comunication using kubectl more convenient you can set the KUBECONFIG environment variable:
export KUBECONFIG="path/to/the/kube.config"
Make the environment variable persistent by adding the export command to .bash_profile(linux) or .zshrc (MacOS) in your home directory:
echo 'export KUBECONFIG="path/to/the/kube.config"' >> ~/.bash_profile # or ~/.zshrc
And then immediately apply the changes to your current shell session:
source ~/.bash_profile # or ~/.zshrc
Available actions
Listing pods:
kubectl --namespace <your-instance-name> get pods
Listing logs from a pod:
kubectl --namespace <your-instance-name> logs <pod-name> # add "-f" flag before "logs" to live-tail the logs
Entering a pod shell:
kubectl --namespace <your-instance-name> exec -it <pod-name> -- bash