Kubernetes

Cloud Agnostic
Open Source

Integrates Notiway with Kubernetes. Reads the pod name and namespace from the Downward API to uniquely identify each gateway instance and discovers container resource limits (CPU and memory) from the Linux cgroup filesystem (both cgroup v1 and v2).

Source code: Notiway.Plugins.Portable.Hosts.Kubernetes

Compatibility

Compatible withAll Buffer, Broker, Storage, and Auth plugins
ProductNotiway Notify

Installation

Environment Variables

VariableRequiredDefaultDescription
Infra__Plugins__Host__NameYesSet to Kubernetes
Infra__Plugins__Host__VersionYesPlugin version (e.g., 0.8.0)

No additional configuration is needed beyond the plugin name and version.

Service identity is derived from the HOSTNAME environment variable (injected by Kubernetes automatically) and POD_NAMESPACE (exposed via the Downward API). The service ID is formatted as namespace/hostname.

Resource limits (CPU and memory) are read from the Linux cgroup filesystem. Both cgroup v2 (/sys/fs/cgroup/cpu.max, /sys/fs/cgroup/memory.max) and cgroup v1 (/sys/fs/cgroup/cpu/cpu.cfs_quota_us, /sys/fs/cgroup/memory/memory.limit_in_bytes) are supported. CPU is reported in millicores and memory in MB.

Infrastructure

  1. Deploy Notiway as a Kubernetes Deployment or StatefulSet.
  2. Expose the pod namespace via the Downward API (the pod name is available by default via HOSTNAME; namespace requires an explicit fieldRef).
  3. Set resource limits on the container so the cgroup values are populated.

Kubernetes Manifest

deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: notiway
spec:
  replicas: 2
  selector:
    matchLabels:
      app: notiway
  template:
    metadata:
      labels:
        app: notiway
    spec:
      containers:
        - name: notiway
          image: notiway/notify:portable-0.6.0
          ports:
            - containerPort: 8080
          resources:
            limits:
              cpu: "1"
              memory: "512Mi"
          env:
            - name: Infra__Plugins__Host__Name
              value: "Kubernetes"
            - name: Infra__Plugins__Host__Version
              value: "0.8.0"
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace