# 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: ```sh 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: ```sh docker build -t your-dockerhub-username/your-image-name:latest . ``` Push the image to Docker Hub: ```sh 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: ```sh 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: ```sh kubectl apply -f job.yaml ``` ## Step 5: Check Job Status Monitor the job status using: ```sh kubectl get jobs ``` To check logs from the running pod: ```sh kubectl logs -f ``` To get the pod name: ```sh kubectl get pods ``` ## Step 6: Clean Up Resources To delete the job after completion: ```sh kubectl delete job subhasis007 ``` To remove the secret: ```sh kubectl delete secret subhasis-env ``` --- This guide ensures that environment variables are securely managed and Kubernetes Jobs are efficiently deployed. 🚀