generic-service
by NanoByte
runs a service (with monitoring, ingress, etc.)
About this chart
Generic Service Helm Chart
This Helm chart simplifies deploying a typical "80% case" service on Kubernetes. It takes care of creating common Resources such as Deployment, Service and Ingress. It also provides optional support for:
- nginx Ingress Controller, HAProxy Ingress Controller, Contour, Istio or Gateway API for routing
- Cilium for network policies with DNS-based egress rules
- Sealed Secrets for encrypted secrets
- External Secrets Operator for secrets from external stores (e.g., Vault or AWS Secrets Manager)
- KEDA for event-driven autoscaling
- Prometheus Operator for monitoring
- Loki Rule Operator or Loki sidecar for logging-based alerting
- OpenTelemetry Operator or Jaeger Operator for tracing
- Flagger and Argo Rollouts for canary and blue-green deployments
The Generic Service Grafana Dashboard is a useful companion to this chart.
Getting started
This chart is most commonly used as a dependency instead of installing it directly. You can reference it in your chart by adding this to your Chart.yaml:
dependencies:
- name: generic-service
version: ~1.15.0
repository: https://helm.nano-byte.net
alias: app
You can then add static configuration to your values.yaml like this:
app:
image:
repository: myservice
tag: 1.2.3
Values
| Value | Default | Description |
|---|---|---|
name | Release Name | The name of the service (used for app.kubernetes.io/name label) |
fullname | Release Name (+ name) | The name of the service instance (used for resource names and app.kubernetes.io/instance label) |
version | same as image.tag | The version of the service (used for app.kubernetes.io/version label) |
image.registry | docker.io | The Registry containing the image to run |
image.repository | required | The name of the image image to run (without the Registry) |
image.tag | required | The tag of the image to run; start with @ for digest instead of tag (e.g., @sha256:abc...) |
image.pullPolicy | IfNotPresent | Set to Always to try to pull new versions of the image |
image.pullSecret | Name of the Kubernetes Secret providing credentials for pulling the image | |
securityContext.pod | runtime default seccomp | Security context to use for the pod |
securityContext.container | drop all capabilites | Security context to use for the container |
command | [] | Overrides the command to launch in the image |
args | [] | The command-line arguments passed to the service |
env | {} | Environment variables passed to the service as a key-value map (keys and values support templating) |
envFrom | {} | Environment variables from other sources (e.g., secretKeyRef); set an entry to null to remove it |
config | {} | YAML/JSON configuration to be mounted as a file in the container |
configMountPath | /config/config.yaml | The file path in the container to mount the data from config into (exposed via $CONFIG_FILE) |
additionalConfigs | [] | Additional ConfigMaps with key named data.yaml to be mounted (paths appended to $CONFIG_FILE) |
secretConfig | {} | YAML/JSON configuration to be stored in a Secret and mounted as a JSON file in the container |
secretConfigMountPath | /secrets/secret.json | The file path in the container to mount the data from secretConfig into (exposed via $CONFIG_FILE) |
secretConfigOptional | false | Start the container even if the Secret for secretConfigEncrypted/secretConfigExternal is missing |
secretConfigEncrypted | kubeseal-encrypted JSON (key secret.json) used instead of secretConfig; creates SealedSecret | |
secretConfigSealingScope | strict | The kubeseal --scope used for secretConfigEncrypted (strict, namespace-wide or cluster-wide) |
secretConfigExternal | Remote secret key (with optional property/version) holding JSON config; creates ExternalSecret | |
secretConfigExternalStore.name | required if external | The name of the SecretStore to read secretConfigExternal from |
secretConfigExternalStore.kind | SecretStore | The kind of the store (SecretStore or ClusterSecretStore) |
secretConfigExternalRefreshInterval | 1h | How often to refresh the ExternalSecret for secretConfigExternal from the store |
dnsConfig | DNS config for the pod | |
startupProbe | Probe that waits for the service to initially start up | |
livenessProbe | Probe that causes the service to be restarted when failing | |
readinessProbe | Probe that prevents the service from receiving traffic when failing | |
maxShutdownSeconds | 30 | The number of seconds the pod has to shutdown before it is terminated |
labels | {} | Additional labels to set on all generated resources |
annotations | {} | Additional annotations to set on the Pod controller and Pods |
resources.requests.memory | 64Mi | The amount of memory requested for the service (recommendation: slightly higher than average usage) |
resources.requests.cpu | 10m | The number of CPU cores requested for the service |
resources.limits.memory | 96Mi | The maximum amount of memory the service may use (recommendation: slightly higher than worst-case usage) |
resources.limits.cpu | 2000m | The maximum number of CPU cores the service may use |
rollout.controller | Deployment | The type of Pod controller to create (Deployment, StatefulSet, DaemonSet or ArgoRollout) |
rollout.strategy | RollingUpdate | The rollout strategy (RollingUpdate, Recreate, OnDelete, Canary or BlueGreen) |
rollout.autoPromotion | true | Automatically promote rollouts (if rollout.strategy is BlueGreen and rollout.flagger if false) |
rollout.flagger | false | Use Flagger to control rollouts (rollout.controller must be Deployment or StatefulSet) |
rollout.analysis | req. for Canary or Flagger | Flagger or Argo Rollouts analysis for automatic Canary or BlueGreen promotion |
rollout.canary.steps | [] | Argo Rollouts canary steps (e.g., setWeight, pause); makes rollout.analysis optional |
rollout.blueGreen.postPromotionAnalysis | Argo Rollouts analysis to run after promoting a BlueGreen rollout | |
rollout.blueGreen.scaleDownDelaySeconds | Seconds to wait before scaling down the previous ReplicaSet after a BlueGreen promotion | |
rollout.revisionHistoryLimit | null | Number of old ReplicaSets to retain (rollout.controller must be Deployment or ArgoRollout) |
rollout.progressDeadlineSeconds | Seconds to make progress before rollout is considered failed (Deployment or ArgoRollout only) | |
rollout.progressDeadlineAbort | false | Abort the rollout when rollout.progressDeadlineSeconds is exceeded (ArgoRollout only) |
rollout.minReadySeconds | Number of seconds a new Pod must be ready before it is considered available | |
rollout.maxSurge | Number/percentage of Pods that can be created above replicas during RollingUpdate or Canary | |
rollout.maxUnavailable | Number/percentage of Pods that can be unavailable during RollingUpdate or Canary | |
rollout.rollbackWindow | Number of recent revisions to roll back to immediately, skipping analysis and steps (ArgoRollout only) | |
rollout.analysisSuccessfulRunHistoryLimit | Number of successful AnalysisRuns and Experiments to retain (ArgoRollout only) | |
rollout.analysisUnsuccessfulRunHistoryLimit | Number of unsuccessful AnalysisRuns and Experiments to retain (ArgoRollout only) | |
replicas | 1 | The number of instances of the service to run |
autoscaling.enabled | false | Enables automatic starting of additional instances |
autoscaling.type | hpa | The type of autoscaler to use (hpa for HorizontalPodAutoscaler or keda for KEDA ScaledObject) |
autoscaling.maxReplicas | 3 | The maximum number of instances to run (must be larger than replicas) |
autoscaling.metric.type | Resource | The type of metric to use for scaling (Resource, Pods, Object or External) (HPA only) |
autoscaling.metric.name | cpu | The name of the metric to use for scaling (HPA only) |
autoscaling.metric.object | req. if type = Object | Reference to the Kubernetes object the metric describes (HPA only) |
autoscaling.metric.selector | {} | Labels f |
Deploy generic-service with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has generic-service on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartgeneric-service is pinned at v1.15.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply