Skip to content
Try Hanzo
Language: English (United States)

Use Hanzo AI with Kubernetes

Deploy Hanzo AI-powered workloads on Kubernetes. Securely manage your Hanzo API key as a K8s secret and inject it into pods.

Get API key — Free
K8s Secretyaml
apiVersion: v1
kind: Secret
metadata:
  name: hanzo-credentials
  namespace: default
type: Opaque
stringData:
  api-key: "your-hanzo-api-key"
2 of 8 lines point at Hanzo

Base URL: https://api.hanzo.ai/v1

API Key: Get yours at platform.hanzo.ai/api-keys · Fully OpenAI-compatible · 400+ models available

Deployment manifest

yaml

3 of 22 lines point at Hanzo
Deployment manifestyaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ai-service
spec:
  replicas: 2
  selector:
    matchLabels:
      app: ai-service
  template:
    spec:
      containers:
        - name: app
          image: my-ai-app:latest
          env:
            - name: HANZO_API_KEY
              valueFrom:
                secretKeyRef:
                  name: hanzo-credentials
                  key: api-key
            - name: OPENAI_API_BASE
              value: "https://api.hanzo.ai/v1"

Apply to cluster

bash

2 of 4 lines point at Hanzo
Apply to clusterbash
kubectl create secret generic hanzo-credentials \
  --from-literal=api-key="your-hanzo-api-key"
 
kubectl apply -f deployment.yaml
kubectl get pods -l app=ai-service

HPA for AI workloads

yaml

HPA for AI workloadsyaml
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: ai-service-hpa
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: ai-service
  minReplicas: 2
  maxReplicas: 10
  metrics:
    - type: Resource
      resource:
        name: cpu
        target:
          type: Utilization
          averageUtilization: 70

Created by CNCF / Google

License: Apache-2.0 · View source on GitHub →

Hanzo AI is OpenAI-compatible, so existing Kubernetes code works with zero refactoring. We deeply appreciate the CNCF / Google team for building and maintaining this open-source project.

Ready to get started?

Create a free account and get your API key. The Free plan includes free model requests and Kai decisions, no card.