Kubernetes
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 with | All Buffer, Broker, Storage, and Auth plugins |
| Product | Notiway Notify |
Installation
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
Infra__Plugins__Host__Name | Yes | — | Set to Kubernetes |
Infra__Plugins__Host__Version | Yes | — | Plugin 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
- Deploy Notiway as a Kubernetes Deployment or StatefulSet.
- Expose the pod namespace via the Downward API (the pod name is available by default via
HOSTNAME; namespace requires an explicitfieldRef). - Set resource limits on the container so the cgroup values are populated.
Kubernetes Manifest
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.5.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