https://github.com/RitikaxG/configmaps-secrets

API object / resource in K8s that are used to inject env variables. Configmaps are used to store non confidential data in Key-Value Pairs
eksctl create cluster --name ingress-cluster --region ap-south-1 --nodes 3 --node-type t2.medium
require("dotenv").config({
path:"./secret/.env"
}) // Get the env variable from this dir
import express from "express"
const app = express()
console.log(process.env.PORT);
console.log(process.env.DATABASE_URL);
app.listen(3000,()=>{
console.log("Listening on port 3000")
})
FROM oven/bun:1
WORKDIR /app
COPY ./package.json ./package.json
COPY ./bun.lock ./bun.lock
RUN bun install
COPY . .
CMD ["bun","run","index.ts"]
docker build --platform=linux/amd64 -t ritikaxg/configmaps-secrets:1 .
dockerhubdocker push ritikaxg/configmaps-secrets:1
docker run -e PORT=3000 -e DATABASE_URL=postgres -p 3000:3000 ritikaxg/configmaps-secrets:1
cm.yml to inject non-confidential data to your podapiVersion: v1
kind: ConfigMap
metadata:
name: config-backend
data:
port: "3000"