Skip to content

Instantly share code, notes, and snippets.

@spdeepak
Last active January 26, 2026 06:46
Show Gist options
  • Select an option

  • Save spdeepak/888174e4d6622f5eb2429cdbfe67064b to your computer and use it in GitHub Desktop.

Select an option

Save spdeepak/888174e4d6622f5eb2429cdbfe67064b to your computer and use it in GitHub Desktop.
How to deploy a podman image on your local k8s running on Mac.

This is how to deploy thw image on your local k8s running on Mac. In reference to the project Aegis

  1. Install kind and kubectl
    brew install kind kubectl
    
  2. Create kind cluster if not already created
    kind create cluster
    kubectl get nodes
    
  3. Build the Docker image with podman
    podman build -t aegis:dev .
    
  4. Save and load image to kind cluster
    podman save localhost/aegis:dev -o aegis.tar
    kind load image-archive aegis.tar
    
  5. Deploy PostgreSQL 18
    kubectl apply -f k8s/postgres.yaml
    
  6. Wait for PostgreSQL to be ready
    kubectl wait --for=condition=ready pod -l app=postgres --timeout=60s
    kubectl get pods
    
  7. Create data extension and run migrations
    kubectl exec deployment/postgres -- psql -U admin -d jwt_server -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
    cat migrations/0001_initial.up.sql | kubectl exec -i deployment/postgres -- psql -U admin -d jwt_server
    
  8. Apply application configuration
    Below command is to create configmap and save it to k8s/configmap.yaml
    kubectl create configmap aegis-config --from-file=configs/application.yaml --from-file=configs/secrets.json --dry-run=client -o yaml > k8s/configmap.yaml
    kubectl apply -f k8s/configmap.yaml
    kubectl apply -f k8s/deployment.yaml
    kubectl apply -f k8s/service.yaml
    
  9. Wait for the application to be ready
    kubectl wait --for=condition=ready pod -l app=aegis --timeout=60s
    kubectl get pods
    
  10. Check logs to verify it's running
    kubectl logs deployment/aegis
    
  11. Access the service locally
    # Port forward to access the API
    kubectl port-forward svc/aegis 8080:80
    # In another terminal, test the API
    curl -X POST http://localhost:8080/api/v1/auth/signup \
      -H "Content-Type: application/json" \
      -d '{
        "email": "test@example.com",
        "firstName": "Test",
        "lastName": "User",
        "password": "TestPassword123!"
      }'
    

When building the image on arm-64 mac using podman it might fail. In that case increase the memory

  • podman machine stop to stop the podman
  • podman machine set --memory 8192 to increase the memory to 8GB
  • podman machine set --cpus 4 to increase the cpus to 4
  • podman machine start to start the podman
  • podman machine info to see the info of the podman. Then Re-run the build
apiVersion: apps/v1
kind: Deployment
metadata:
name: aegis
labels:
app: aegis
spec:
replicas: 1
selector:
matchLabels:
app: aegis
template:
metadata:
labels:
app: aegis
spec:
containers:
- name: aegis
image: localhost/aegis:dev
imagePullPolicy: Never
ports:
- containerPort: 8080
env:
- name: JWT_MASTER_KEY
value: "qwertyuiopasdfghjklzxcvbnmqazwsx"
volumeMounts:
- name: app-config
mountPath: /app/configs
livenessProbe:
httpGet:
path: /live
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
readinessProbe:
httpGet:
path: /ready
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
volumes:
- name: app-config
configMap:
name: aegis-config
---
apiVersion: v1
kind: Service
metadata:
name: aegis
namespace: default
spec:
selector:
app: aegis
ports:
- port: 80
targetPort: 8080
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
spec:
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres:18
env:
- name: POSTGRES_DB
value: jwt_server
- name: POSTGRES_USER
value: admin
- name: POSTGRES_PASSWORD
value: admin
ports:
- containerPort: 5432
volumeMounts:
- name: postgres-storage
mountPath: /var/lib/postgresql
volumes:
- name: postgres-storage
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: postgres
spec:
selector:
app: postgres
ports:
- port: 5432
targetPort: 5432
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment