Now when we have installed Docker Desktop along with kubernetes. We are ready to deploy containers on local Kubernetes which we have installed in our laptop.
WAIT!!!!!!
Our real goal is to deploy container at RI.SE ICEKUBE (kubernetes infrastructure) and harness the power of GPUs, to do that we have to modify the config file at our local system to authenticate and access the remote Kubernetes infrastructure (which can be any cloud platform such as AWS, GCP, Azure or on-premise infrastructure like icekube Kubernetes cluster provided by RI.SE)
To make it more simpler, we have keep the config file ready for you at private github link. You can ask any existing group member to add you to the github repository for icekube config file so you can download the config file.
Once you access the repository, you can download or copy the config file from this link.
Steps to follow:
- Take the backup of the existing config file and name it config_backup.
- Now, replace the existing config file with the name config in the folder with the path “C:\Users\sumrak\.kube” with the downloaded config file.
- Now we need to add some lines from the config_backup to the modified config file. Follow the below instructions:
Select lines from the config_backup file and paste them by replacing them in the matching location in the config file.
![Select 3 lines under the cluster referring to docker desktop from config_backup file](https://blog.ltu-ai.dev/wp-content/uploads/2022/04/1_backup.jpg)
![Paste the lines (copied from config_backup) in config file by replacing the selected three lines as shown in the image.](https://blog.ltu-ai.dev/wp-content/uploads/2022/04/2_config-1.jpg)
Again select lines from the config_backup file and paste them by replacing them in the matching location in the config file.
![Select 3 lines under the users: heading referring to docker desktop from config_backup file](https://blog.ltu-ai.dev/wp-content/uploads/2022/04/3_backup.jpg)
![Paste the lines (copied from config_backup) in the config file by replacing the selected three lines as shown in the image.](https://blog.ltu-ai.dev/wp-content/uploads/2022/04/4_config.jpg)
Note
Replace “sumrak” with your Windows username
Once you are done, restart the docker desktop and Kubernetes. Open Windows Power Shell and try kubectl based command to switch context from local to remote Kubernetes. We will explain the different commands below to view the current context, how to switch from local to remote context and vice versa.
Table of Contents
Command to list the current context used.
kubectl config current-context
![Kubectl command to check the current context used.](https://blog.ltu-ai.dev/wp-content/uploads/2022/04/1_current_config.jpg)
Command to view all contexts via the config command
kubectl config get-contexts
![View all contexts via the config command](https://blog.ltu-ai.dev/wp-content/uploads/2022/04/2_all_configs.jpg)
Note
The * represents the current context. For remote access we are only entitled to use icekube cluster with namespace ltu-default
Command to switch from existing context to icekube context without namespace
kubectl config use-context icekube
![Command to switch from existing context to another context without namespace](https://blog.ltu-ai.dev/wp-content/uploads/2022/04/3_switch_to_remote.jpg)
Note
Without using the namespace we may not authorized to access all the resource in the icekube cluster so better use below command by mentioning context and namespace together.
Command to switch from existing context to icekube context with ltu-default namespace
kubectl config set-context icekube --namespace=ltu-default OR kubectl config use-context icekube kubectl config set-context --current --namespace=ltu-default
![Command to switch from existing context to another remote context with namespace](https://blog.ltu-ai.dev/wp-content/uploads/2022/04/4_switch_to_context_namespace.jpg)
List all the resources for the current context.
Using the kubectl get all command we can list down all the pods, services, statefulsets, etc. in a namespace but not all the resources are listed using this command in a cluster.
List all the resources for the current context at cluster level.
kubectl get all
![List all the resources for the current context at cluster level.](https://blog.ltu-ai.dev/wp-content/uploads/2022/04/5_kubectl_get_all.jpg)
Note
RI.SE Kubernetes cluster is a multi-tenant, so when we setup the config file for Kubernetes. We can only run kubectl related commands accessible within the namespace.
When we modified the config file inside ./kube/config (we added the config file downloaded from the icekube). The config file is modified to operate at cluster level. But the users linked to ltu-default namespace cannot run kubectl commands at cluster level.
List all the resources for the current context within a namespace.
kubectl get all -n ltu-default
![List all the resources for the current context within a namespace.](https://blog.ltu-ai.dev/wp-content/uploads/2022/04/6_kubectl_get_namespace.png)