Alphakdeps.io is experimental and evolving — the registry and packages may change or reset.
Kubernetes templatekdeps asset

kdeps-k8s-manifests

v1.2.0

kdeps manifest: manifests

set k8s / shelf deploy

PurposeThe Deployment, Service and NetworkPolicy templates of a Kubernetes export.

LLM context: none - kdeps uses it without sending it to the model

Where it runs

Part of the k8s set, used in the kdeps CLI. The Deployment, Service and NetworkPolicy templates of a Kubernetes export.

  1. kdeps export k8s
  2. the manifests are rendered from the templatesk8s/manifests
  3. you apply them with kubectl
  4. the workflow runs in the cluster

Loaded by: kdeps export k8s

In the code: kdeps export k8sk8s.(*Generator).GenerateManifestsk8s.(*Generator).renderManifest

Install

A kdeps asset: installed with the first-run profile that includes its set, or the first time a command needs it, and updated without a new release.

kdeps install k8s/manifests

Pin a version with kdeps install k8s/manifests@<version>.

Contents

kdeps
>=3.7.0

deployment.yaml.tmpl

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .Name }}
  labels:
    app: {{ .Name }}
    version: {{ .Version }}
    kdeps-component: "true"
spec:
  replicas: {{ .Replicas }}
  selector:
    matchLabels:
      app: {{ .Name }}
  template:
    metadata:
      labels:
        app: {{ .Name }}
    spec:
      automountServiceAccountToken: false  # kdeps workloads never call the Kubernetes API
      securityContext:
        runAsNonRoot: true
        seccompProfile:
          type: RuntimeDefault
      containers:
      - name: {{ .Name }}
        image: {{ .Image }}
        securityContext:
          allowPrivilegeEscalation: false
          readOnlyRootFilesystem: false
          capabilities:
            drop: ["ALL"]
        ports:
        {{- if .APIPort }}
        - containerPort: {{ .APIPort }}
          name: api
        {{- end }}
        {{- if .WebServerPort }}
        - containerPort: {{ .WebServerPort }}
          name: web
        {{- end }}
        {{- if .BackendPort }}
        - containerPort: {{ .BackendPort }}
          name: backend
        {{- end }}
        env:
        - name: KDEPS_SCALE_DIRECT  # the cluster scales the pods, so kdeps serves the port itself
          value: "1"
        {{- if .HasAPIServer }}
        - name: KDEPS_API_AUTH_TOKEN
          valueFrom:
            secretKeyRef:
              name: {{ .Name }}-auth
              key: api-token
        - name: KDEPS_MANAGEMENT_TOKEN
          valueFrom:
            secretKeyRef:
              name: {{ .Name }}-auth
              key: management-token
              optional: true
        {{- end }}
        {{- range $key, $value := .Env }}
        - name: {{ $key }}
          value: "{{ $value }}"
        {{- end }}
        {{- range $key := .SecretEnv }}
        - name: {{ $key }}
          valueFrom:
            secretKeyRef:
              name: {{ $.Name }}-env
              key: {{ $key }}
        {{- end }}
        {{- if .Resources }}
        resources:
          limits:
            cpu: "{{ .Resources.CPULimit }}"
            memory: "{{ .Resources.MemoryLimit }}"
          requests:
            cpu: "{{ .Resources.CPURequest }}"
            memory: "{{ .Resources.MemoryRequest }}"
        {{- end }}
        {{- if .HasAPIServer }}
        readinessProbe:
          httpGet:
            path: /health
            port: api
          initialDelaySeconds: 10
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /health
            port: api
          initialDelaySeconds: 30
          periodSeconds: 30
        {{- else if .WebServerPort }}
        # Web server has no /health endpoint; probe the TCP socket instead.
        readinessProbe:
          tcpSocket:
            port: web
          initialDelaySeconds: 10
          periodSeconds: 10
        livenessProbe:
          tcpSocket:
            port: web
          initialDelaySeconds: 30
          periodSeconds: 30
        {{- end }}

httpscaledobject.yaml.tmpl

# KEDA HTTP add-on: scales the Deployment to zero. Send traffic through the
# KEDA HTTP interceptor; it holds a request while a pod starts.
apiVersion: http.keda.sh/v1alpha1
kind: HTTPScaledObject
metadata:
  name: {{ .Name }}
  labels:
    app: {{ .Name }}
    kdeps-component: "true"
spec:
  scaleTargetRef:
    name: {{ .Name }}
    kind: Deployment
    apiVersion: apps/v1
    service: {{ .Name }}
    port: {{ .WakePort }}
  replicas:
    min: {{ .Scale.Min }}
    {{- if .Scale.Max }}
    max: {{ .Scale.Max }}
    {{- end }}
  {{- if .ScaledownSeconds }}
  scaledownPeriod: {{ .ScaledownSeconds }}
  {{- end }}
  {{- if .Concurrency }}
  scalingMetric:
    concurrency:
      targetValue: {{ .Concurrency }}
  {{- end }}

knative.yaml.tmpl

# Knative Service: scales to zero. The first request waits while a pod starts.
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: {{ .Name }}
  labels:
    app: {{ .Name }}
    version: {{ .Version }}
    kdeps-component: "true"
spec:
  template:
    metadata:
      labels:
        app: {{ .Name }}
      annotations:
        autoscaling.knative.dev/min-scale: "{{ .Scale.Min }}"
        {{- if .Scale.Max }}
        autoscaling.knative.dev/max-scale: "{{ .Scale.Max }}"
        {{- end }}
        {{- if .Scale.Idle }}
        autoscaling.knative.dev/scale-to-zero-pod-retention-period: "{{ .Scale.Idle }}"
        {{- end }}
    spec:
      {{- if .Concurrency }}
      containerConcurrency: {{ .Concurrency }}
      {{- end }}
      {{- if .TimeoutSeconds }}
      timeoutSeconds: {{ .TimeoutSeconds }}
      {{- end }}
      containers:
      - name: {{ .Name }}
        image: {{ .Image }}
        securityContext:
          runAsNonRoot: true
          allowPrivilegeEscalation: false
          readOnlyRootFilesystem: false
          capabilities:
            drop: ["ALL"]
          seccompProfile:
            type: RuntimeDefault
        ports:
        - containerPort: {{ .WakePort }}
        env:
        - name: KDEPS_SCALE_DIRECT  # the cluster scales the pods, so kdeps serves the port itself
          value: "1"
        {{- if .HasAPIServer }}
        - name: KDEPS_API_AUTH_TOKEN
          valueFrom:
            secretKeyRef:
              name: {{ .Name }}-auth
              key: api-token
        - name: KDEPS_MANAGEMENT_TOKEN
          valueFrom:
            secretKeyRef:
              name: {{ .Name }}-auth
              key: management-token
              optional: true
        {{- end }}
        {{- range $key, $value := .Env }}
        - name: {{ $key }}
          value: "{{ $value }}"
        {{- end }}
        {{- range $key := .SecretEnv }}
        - name: {{ $key }}
          valueFrom:
            secretKeyRef:
              name: {{ $.Name }}-env
              key: {{ $key }}
        {{- end }}
        {{- if .Resources }}
        resources:
          limits:
            cpu: "{{ .Resources.CPULimit }}"
            memory: "{{ .Resources.MemoryLimit }}"
          requests:
            cpu: "{{ .Resources.CPURequest }}"
            memory: "{{ .Resources.MemoryRequest }}"
        {{- end }}
        readinessProbe:
          {{- if .HasAPIServer }}
          httpGet:
            path: /health
          {{- else }}
          tcpSocket: {}
          {{- end }}

networkpolicy.yaml.tmpl

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: {{ .Name }}
  labels:
    app: {{ .Name }}
    kdeps-component: "true"
spec:
  podSelector:
    matchLabels:
      app: {{ .Name }}
  # Ingress is restricted to the ports this workflow actually serves.
  # Egress is deliberately unrestricted: chat/httpClient/searchWeb/sql
  # resources must reach external services.
  policyTypes:
  - Ingress
{{- if or .APIPort .WebServerPort }}
  ingress:
  - ports:
{{- if .APIPort }}
    - protocol: TCP
      port: {{ .APIPort }}
{{- end }}
{{- if .WebServerPort }}
    - protocol: TCP
      port: {{ .WebServerPort }}
{{- end }}
{{- end }}

service.yaml.tmpl

apiVersion: v1
kind: Service
metadata:
  name: {{ .Name }}
  labels:
    app: {{ .Name }}
spec:
  selector:
    app: {{ .Name }}
  ports:
  {{- if .APIPort }}
  - name: api
    port: {{ .APIPort }}
    targetPort: api
  {{- end }}
  {{- if .WebServerPort }}
  - name: web
    port: {{ .WebServerPort }}
    targetPort: web
  {{- end }}
  {{- if .BackendPort }}
  - name: backend
    port: {{ .BackendPort }}
    targetPort: backend
  {{- end }}
  type: ClusterIP

Versions

VersionPublishedStatusSource
1.2.011/28/2026activeGitHub v1.2.0
1.1.011/28/2026activeGitHub v1.1.0
1.0.011/21/2026activeGitHub v1.0.0

Details

Author
kdeps
License
Apache-2.0
Latest Version
1.2.0
Published
11/21/2026

Tags

kdepsmanifest