conv_intent / build-help.md
subhasis79's picture
Upload folder using huggingface_hub
9cb1789 verified

Kubernetes Job Deployment Guide

This guide provides step-by-step instructions to deploy a Kubernetes Job using environment variables stored in a .env file.

Step 1: Create a .env File

Create a file named .env and add the following environment variables:

MODEL_NAME=meta-llama/Llama-3.1-70B
HUG_TOKEN=hf_SuperSecretSauce123
HUG_TOKEN_RT=hf_ThisIsNotTheTokenYouAreLookingFor

Step 2: Build and Push Docker Image

Before running the Kubernetes Job, build and push the Docker image to a container registry (Docker Hub).

Build the Docker image:

docker build -t your-dockerhub-username/your-image-name:latest .

Push the image to Docker Hub:

docker push your-dockerhub-username/your-image-name:latest

Ensure that your Kubernetes Job YAML references this Docker image.

Step 3: Create a Kubernetes Secret from the .env File

Run the following command to create a Kubernetes Secret from the .env file:

kubectl create secret generic subhasis-env --from-env-file=.env

Step 4: Deploy the Kubernetes Job

Apply the Kubernetes Job YAML file to the cluster:

kubectl apply -f job.yaml

Step 5: Check Job Status

Monitor the job status using:

kubectl get jobs

To check logs from the running pod:

kubectl logs -f <pod-name>

To get the pod name:

kubectl get pods

Step 6: Clean Up Resources

To delete the job after completion:

kubectl delete job subhasis007

To remove the secret:

kubectl delete secret subhasis-env

This guide ensures that environment variables are securely managed and Kubernetes Jobs are efficiently deployed. 🚀