> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy an open source LLM on CKS

> Step-by-step guide for deploying Meta's Llama 3.1 model on CKS with cluster and Node Pool setup

This tutorial walks you through deploying Meta's Llama 3.1 8B Instruct open source LLM on CoreWeave Kubernetes Service (CKS), so you can run inference against a hosted model from your own cluster. It's for developers and ML practitioners who are new to CKS and want a complete, end-to-end example of provisioning GPU infrastructure and serving a model.

You'll complete the following steps:

* Create a cluster in CKS.
* Create a Node Pool.
* Interact with clusters and Pods using `kubectl`.
* Deploy and interact with an LLM using [Open WebUI](https://docs.openwebui.com/).

## Before you begin

Before completing the steps in this guide, you must have the following:

* Access to the `Llama-3.1-8B-Instruct` model at Hugging Face. Go to [meta-llama/Llama-3.1-8B-Instruct](https://huggingface.co/meta-llama/Llama-3.1-8B) and request access. Approval for restricted models can take a few hours or longer, so request access before you start the rest of this guide.
* `kubectl` installed on your machine. `kubectl` is the command-line tool for interacting with Kubernetes clusters. If needed, see the [kubectl installation instructions](https://kubernetes.io/docs/tasks/tools/).
* Access to the CoreWeave Cloud Console. For more information, see [Activate and sign in to your CoreWeave organization](/security/authn-authz/activate-org).
* A Hugging Face access token. See the Hugging Face instructions at [User access tokens](https://huggingface.co/docs/hub/en/security-tokens). Be sure to copy and store the token in a secure location. You need it later in this guide.

<Warning>
  **Cost and security disclaimer**

  * Using resources, such as compute, incurs charges. Monitor your resource usage to avoid unexpected charges.
  * CoreWeave is not responsible for the security of the Llama model provided by Hugging Face or the Open Web UI container image.
</Warning>

## Create a CKS cluster and Node Pool

CKS clusters and Node Pools are the core infrastructure for running and managing workloads. To create a cluster and Node Pool, complete the following steps:

1. Log in to the Cloud Console and navigate to the [Clusters](https://console.coreweave.com/clusters) page.

2. Click the **Create Cluster** button.

3. In the **Create a Cluster** dialog, give the cluster a name, select the latest Kubernetes version, and verify the box is checked for **Enable access to the Kubernetes API via the Internet**. Click **Next**.

   <img src="https://mintcdn.com/coreweave-dbfa0e8d/AlCbSsO2S3QckIw4/products/cks/_media/create-a-cluster.png?fit=max&auto=format&n=AlCbSsO2S3QckIw4&q=85&s=41ea6f2dae39a5d65eaee52bd1bd2bb5" alt="Create a cluster in the console." style={{ maxWidth: '800px', width: '100%', height: 'auto' }} width="1743" height="1419" data-path="products/cks/_media/create-a-cluster.png" />

4. Create the cluster where you have GPU quota available. Verify the box is checked for **Create a default VPC**, and then click **Next**.

   <img src="https://mintcdn.com/coreweave-dbfa0e8d/tk0Jf62-ZaeUJuQx/products/cks/_media/gpu-quota.png?fit=max&auto=format&n=tk0Jf62-ZaeUJuQx&q=85&s=40424e6821468714b9786e46d33b577f" alt="Select the region where you have GPU quota." style={{ maxWidth: '800px', width: '100%', height: 'auto' }} width="1452" height="1419" data-path="products/cks/_media/gpu-quota.png" />

5. Leave the authentication boxes unchecked and click **Next**.

   <img src="https://mintcdn.com/coreweave-dbfa0e8d/AlCbSsO2S3QckIw4/products/cks/_media/auth.png?fit=max&auto=format&n=AlCbSsO2S3QckIw4&q=85&s=e91a397a481f24d5cc7b44210ab72c37" alt="Cluster authentication options in the create cluster flow." style={{ maxWidth: '800px', width: '100%', height: 'auto' }} width="1182" height="699" data-path="products/cks/_media/auth.png" />

6. On the deploy page, click **Submit**.

7. On the **Success!** dialog box, click **Create a Node Pool**.

8. Verify the cluster you just created is selected, and do the following:
   * Name the Node Pool.
   * Pick a GPU instance.
   * Set **Target Nodes** to `1`.
   * Leave all other fields empty.
   * Click **Submit**.

Node Pool creation can be delayed while the cluster is being created. Then, Node Pool provisioning can take up to 30 minutes. When the Node Pool status is `Healthy`, your cluster has GPU capacity ready to serve the model, and you can continue to the following steps.

#### Do not install the NVIDIA GPU Operator on CKS clusters

<Warning>
  CoreWeave manages the [NVIDIA GPU Operator](https://docs.nvidia.com/datacenter/cloud-native/gpu-operator/latest/getting-started.html) on your behalf. Do not install the NVIDIA GPU Operator on CKS clusters. Doing so conflicts with the platform-managed deployment and is not supported.
</Warning>

## Generate a CoreWeave access token

Access tokens let you authenticate to your Kubernetes resources through `kubectl`. You must create one for the cluster you just provisioned before you can run commands against it.

To create an access token, complete the following steps:

1. In the Cloud Console, navigate to the [Tokens](https://console.coreweave.com/tokens) page and click the **Create Token** button.
2. Enter a name and expiration and then click **Create**.
3. In the **Create API Token** dialog, select the cluster you just created from the **Select current-context** dropdown menu, and then click **Download**.

   <img src="https://mintcdn.com/coreweave-dbfa0e8d/AlCbSsO2S3QckIw4/products/cks/_media/access-tokens.png?fit=max&auto=format&n=AlCbSsO2S3QckIw4&q=85&s=d01f5f277a978e0820da4c78ac68d543" alt="Create API Token dialog with current-context and download." style={{ maxWidth: '800px', width: '100%', height: 'auto' }} width="1299" height="1419" data-path="products/cks/_media/access-tokens.png" />

## Use `kubectl` with your cluster

To communicate with your cluster using `kubectl`, complete the following steps:

1. Make a `KUBECONFIG` environment variable that points to the `kubeconfig` file you just downloaded, for example:

   ```bash theme={"system"}
   export KUBECONFIG=~/Downloads/[CW-KUBECONFIG-FILENAME]
   ```

2. Confirm you can connect to the cluster with the following command:

   ```bash theme={"system"}
   kubectl cluster-info
   ```

   You should see cluster information like the following:

   ```text theme={"system"}
   Kubernetes Control Plane is running at https://****.k8s.us-east-02a.coreweave.com
   CoreDNS is running at https://****.k8s.us-east-02a.coreweave.com/api/v1/namespaces/kube-system/services/coredns:dns/proxy
   node-local-dns is running at https://****.k8s.us-east-02a.coreweave.com/api/v1/namespaces/kube-system/services/node-local-dns:dns/proxy
   ```

## Create a Hugging Face secret

For CKS to download the `llama-3.1-8B-Instruct` model from Hugging Face, you must create a Kubernetes secret that holds your Hugging Face access token. The model deployment in the next section reads this secret at runtime to authenticate with Hugging Face.

Complete the following steps to create the secret:

1. Run the following command to create a Hugging Face secret:

   ```bash theme={"system"}
   kubectl create secret generic hf-token-secret --from-literal=api_token=[HUGGING-FACE-TOKEN]
   ```

   * `[HUGGING-FACE-TOKEN]`: This is the token Hugging Face provides you. For more information about creating a Hugging Face token, see [User access tokens](https://huggingface.co/docs/hub/en/security-tokens).

## Download and apply a YAML configuration file

Kubernetes uses YAML files to configure resources. The following example YAML file defines the model deployment and the Open WebUI service so you can deploy both with a single command. To deploy the `Llama-3.1-8B-Instruct` model using this example, complete the following steps:

1. Use `kubectl` to apply the file by running the following command:

   <Danger>
     Before running the command, confirm you have access to the `Llama-3.1-8B` model. Visit the [`meta-llama/Llama-3.1-8B-Instruct` page](https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct) to verify your access.
   </Danger>

   ```bash theme={"system"}
   kubectl apply -f https://raw.githubusercontent.com/coreweave/doc-examples/refs/heads/main/cks/llm-on-cks.yaml
   ```

2. Confirm Kubernetes deployed the resources by running the following commands:

   ```bash theme={"system"}
   kubectl get pods
   ```

   Verify all Pods are ready and running. The output should look like the following:

   ```text theme={"system"}
   NAME                                       READY   STATUS    RESTARTS   AGE
   llama-3-1-8b-deployment-77f4559f9f-wdvpj   1/1     Running   0          2m53s
   open-webui-5b464664d8-942cg                1/1     Running   0          2m53s
   ```

3. Verify the services are working by running the following commands:

   ```bash theme={"system"}
   kubectl logs [LLAMA-POD-NAME]
   ```

   * `[LLAMA-POD-NAME]`: The Pod name beginning with `llama-*` that `kubectl get pods` returns.

   * In the logs, look for the following line: `INFO:     Application startup complete.`

## Get the Open WebUI endpoint

The Open WebUI service is not exposed to the internet. To access [Open WebUI](https://docs.openwebui.com/) from your machine, use port-forwarding:

1. Run the following command to forward local port 8080 to the Open WebUI service:

   ```bash theme={"system"}
   kubectl port-forward svc/open-webui-svc 8080:80
   ```

2. Leave the command running and open `http://localhost:8080` in your browser.

The UI and model remain accessible only from the machine running the port-forward, not from the internet.

You should now see the Open WebUI site, where you can chat with the deployed Llama 3.1 model:

<img src="https://mintcdn.com/coreweave-dbfa0e8d/tk0Jf62-ZaeUJuQx/products/cks/_media/open-webui.png?fit=max&auto=format&n=tk0Jf62-ZaeUJuQx&q=85&s=f0c08102b6fdd17401897d98ec4ef854" alt="Open WebUI site" style={{ maxWidth: '800px', width: '100%', height: 'auto' }} width="1077" height="897" data-path="products/cks/_media/open-webui.png" />

## Next steps

You've deployed an LLM on CKS.

* For more information about CKS clusters, see [Introduction to clusters](/products/cks/clusters/introduction).
* For more information about Node Pools, see [Introduction to Node Pools](/products/cks/nodes/nodes-and-node-pools).
