-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
K8s local deployment and documentation updated (#1548)
* added script to deploy a k8s cluster locally * Updated the README * basic documentation update * experimental documentation updated * updated deployment configuration * remove failed link in docker compose * applied tips for resources assignment * use tox command instead
- Loading branch information
Showing
18 changed files
with
426 additions
and
578 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#! /bin/bash | ||
|
||
set -ex | ||
|
||
cat <<EOF | kind create cluster --config=- | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
nodes: | ||
- role: control-plane | ||
image: kindest/node:v1.29.4 | ||
kubeadmConfigPatches: | ||
- | | ||
kind: InitConfiguration | ||
nodeRegistration: | ||
kubeletExtraArgs: | ||
node-labels: "ingress-ready=true" | ||
extraPortMappings: | ||
- containerPort: 80 | ||
hostPort: 80 | ||
protocol: TCP | ||
- containerPort: 443 | ||
hostPort: 443 | ||
protocol: TCP | ||
EOF | ||
|
||
kubectl label node kind-control-plane has-gpu=gpu has-cpu=cpu | ||
kubectl apply -f https://kind.sigs.k8s.io/examples/ingress/deploy-ingress-nginx.yaml | ||
|
||
docker build -t gateway:test -f ./gateway/Dockerfile . | ||
kind load docker-image gateway:test | ||
docker image rm gateway:test | ||
|
||
docker build -t ray:test -f ./Dockerfile-ray-node . | ||
kind load docker-image ray:test | ||
docker image rm ray:test | ||
|
||
cd charts/qiskit-serverless | ||
helm repo add bitnami https://charts.bitnami.com/bitnami | ||
helm repo add kuberay https://ray-project.github.io/kuberay-helm | ||
helm dependency build | ||
helm install qs \ | ||
--set platform=kind \ | ||
--set nginxIngressControllerEnable=false \ | ||
--set gateway.image.repository=gateway \ | ||
--set gateway.image.tag=test \ | ||
--set gateway.application.ray.nodeImage=ray:test \ | ||
--set gateway.application.ray.proxyImage=proxy:test \ | ||
--set gateway.application.ray.cpu=1 \ | ||
--set gateway.application.debug=1 \ | ||
--set gateway.application.limits.keepClusterOnComplete=false \ | ||
--set gateway.application.authMockproviderRegistry=test \ | ||
--set gateway.application.proxy.enabled=false \ | ||
--set ingress.hosts[0].host=localhost \ | ||
--set ingress.hosts[0].paths[0].path=/ \ | ||
--set ingress.hosts[0].paths[0].pathType=Prefix \ | ||
--set ingress.hosts[0].paths[0].serviceName=gateway \ | ||
--set ingress.hosts[0].paths[0].servicePort=8000 \ | ||
. | ||
|
||
kubectl wait \ | ||
--for=condition=ready pod \ | ||
--selector=app.kubernetes.io/name=gateway-scheduler \ | ||
--timeout=5m | ||
|
||
kubectl wait \ | ||
--for=condition=ready pod \ | ||
--selector=app.kubernetes.io/name=gateway \ | ||
--timeout=5m | ||
|
||
kubectl wait --namespace ingress-nginx \ | ||
--for=condition=ready pod \ | ||
--selector=app.kubernetes.io/component=controller \ | ||
--timeout=5m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,13 +31,21 @@ on your local machine straightforward. The first thing we will do is clone the r | |
cd /path/to/workspace/ | ||
git clone [email protected]:Qiskit/qiskit-serverless.git | ||
Step 2: Set up Docker | ||
Step 2: Setup Docker | ||
|
||
To set up Qiskit Serverless on your local machine, you will need to use `docker compose`_. | ||
To setup Qiskit Serverless on your local machine, you will need to use docker compose. As we mentioned in the `README <https://github.com/Qiskit/qiskit-serverless/blob/main/README.md>`_ | ||
you can use any runtime that you prefer to run Docker on your machine: Docker Desktop, podman... | ||
If you are using a MacOS with ARM processors we highly recommend to use `Colima <https://github.com/abiosoft/colima>`_ | ||
as your container runtime to avoid problems with that architecture. | ||
|
||
.. _docker compose: https://docs.docker.com/compose/ | ||
This is a project that takes advantage of distributed computing, so it places a high demand on resources. We recommend increasing the assigned resources to these runtimes. | ||
In case of Colima for example we typically use: | ||
|
||
Step 3: Initiate the test cluster | ||
.. code-block:: | ||
$ colima start --cpu 4 --memory 8 --disk 100 | ||
Step 2.1: Initiate the test environment | ||
|
||
Once you have Docker and docker compose installed, you can run the following command from the root of the | ||
``qiskit-serverless`` repository to set up the infrastructure: | ||
|
@@ -50,8 +58,27 @@ Additionally, you can include the profile `full`. | |
With the full profile installs all core services, including logging and | ||
monitorying systems. | ||
|
||
Step 3: Setup Kind | ||
|
||
Additionally we provide you a way to deploy a k8s cluster on your local machine. This has some benefits as this is a more similar environment | ||
to production than the docker-compose approach. | ||
|
||
To simplify the process to deploy a k8s cluster locally we use `Kind <https://kind.sigs.k8s.io/docs/user/quick-start#installation>`_ | ||
as the main tool to create a cluster. | ||
|
||
Step 3.1: Initiate the test cluster | ||
|
||
To setup the cluster for testing we prepare a little script that will initialize for you all the needed resources. You can execute it | ||
using the terminal just running the next command: | ||
|
||
.. code-block:: | ||
$ tox -e cluster-deploy | ||
Step 4: Run a program in the test environment | ||
|
||
Once the containers are running, you can simulate a remote cluster with the resources on your | ||
local machine. To create and run programs in this simulated cluster, we recommend using `Jupyter Lab <https://jupyter.org/install>`_. Refer to the :ref:`getting_started` guides | ||
for details about running your program remotely. | ||
local machine. Feel free to go to our tutorials in the `Getting started section <https://qiskit.github.io/qiskit-serverless/getting_started/index.html>`_ | ||
and run some of them. | ||
|
||
|
Oops, something went wrong.