K8S Implementation of SkyPilot¶
We introduce to use k8s to implement SkyPilot based on local laptop "cluster".
Why choose k8s
Frankly speaking, implemeting SkyPilot based on k8s is not the best choice.
You can choose GCP / AWS / Azure / etc, for they have a powerful functionality combined with corresponding GPU.
But! They are toooooooooooo expensive for 99% of us.
So I would like to use k8s instead, even though using k8s cannot provide GPU service :(
You can access full start guide here
Step Pipeline¶
To prepare a Kubernetes cluster to run SkyPilot, the cluster administrator must:
- Deploy a cluster running Kubernetes v1.20 or later.
- Set up GPU support.
- [Optional] Set up ports for exposing services.
- [Optional] Set up permissions: create a namespace for your users and/or create a service account with minimal permissions for SkyPilot.
After these steps, the administrator can share the kubeconfig
file with users, who can then submit tasks to the cluster using SkyPilot.
Step 1 - Deploy a Kubernetes Cluster¶
You can refer to this part on website
After all setup done, you can create your own node:
Bash | |
---|---|
1 |
|
Under the hood, sky local up
uses kind, a tool for creating a Kubernetes cluster on your local machine.
Just for Fun
kind does not support multiple nodes and GPUs.
It is not recommended for use in a production environment.
So using k8s to implement SkyPilot based on local laptop "cluster" is not the best choice for real work.
Step 2 - Set up GPU Support¶
We skip this :(
The reason for skipping is that I use Apple Silicon, which does not support nvidia GPU virtualization.
Step 3 - Verifying Setup¶
Check Status¶
Once the cluster is deployed and you have placed your kubeconfig at ~/.kube/config
, verify your setup by running sky check
:
Bash | |
---|---|
1 |
|
This should show Kubernetes: Enabled without any warnings.
Bash | |
---|---|
1 2 3 4 5 6 7 8 9 10 |
|
Check GPU Status¶
You can also check the GPUs available on your nodes by running:
Bash | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
my own output:
Bash | |
---|---|
1 2 |
|
List SkyPilot resources¶
Bash | |
---|---|
1 2 |
|
Summary¶
After all the startup steps, you can use SkyPilot to run your tasks on the Kubernetes cluster.
The pipeline is:
- Start local machine
docker
(as for me, it isdocker-desktop
) - Start the 1-node Kubernetes cluster locally, which is
sky local up
- Check cluster status by
sky status
- Conducting tasks ......
- After the task is completed, you can delete the cluster by
sky local down
Q & A¶
You may feel confused about some concepts:
Bash | |
---|---|
1 2 3 4 5 6 |
|
There are two "helper" related to skypilot
, one is kind
, and the other is docker-desktop
.
The kind
is a function to "virtually make" a local Kubernetes cluster, and the docker-desktop
is the local Docker container.
KIND
kind is a tool for running local Kubernetes clusters using Docker container “nodes”.
kind was primarily designed for testing Kubernetes itself, but may be used for local development or CI.
- The skypilot is application-level, and is based on the Kubernetes cluster.
- The cluster need to be controlled by container, which is
docker-desktop
.
Hence, You can understand the relationship between skypilot
, kind
, and docker-desktop
:
Bash | |
---|---|
1 |
|
Therefore, if you close the docker-desktop
, the cluster will be closed, and the skypilot
will not be able to run.
So my advice is: make sure the docker-desktop
is running before you use skypilot
, better to be set into auto-start
.