daemonset
by Snowplow
A Helm Chart to deploy an arbitrary container as a daemonset.
About this chart
daemonset
A helm chart to deploy an arbitrary container as a daemonset.
TL;DR
helm repo add snowplow-devops https://snowplow-devops.github.io/helm-charts
helm install daemonset snowplow-devops/daemonset
Introduction
This chart attempts to take care of all the most common requirements of launching a long-running service as a daemonset:
- Downloading from private Docker repositories
- Mounting config volumes
- Mounting host volumes
- Configuring secrets
- Binding service-accounts with cloud specific IAM policies
Note: This should be a long running process - if you are looking for cron-based execution see our cron-job chart.
This chart won't solve for every possible option of deploying a service - it is meant to serve as an opinionated starting point to get something working decently well. For more flexibility open a PR or fork this chart to suit your specific needs.
Installing the Chart
Install or upgrading the chart with default configuration:
helm upgrade --install daemonset snowplow-devops/service-deployment
Uninstalling the Chart
To uninstall/delete the daemonset release:
helm delete daemonset
Requirements
| Repository | Name | Version |
|---|---|---|
| https://snowplow-devops.github.io/helm-charts | cloudserviceaccount | 0.3.0 |
| https://snowplow-devops.github.io/helm-charts | dockerconfigjson | 0.1.0 |
Values
| Key | Type | Default | Description |
|---|---|---|---|
| global.cloud | string | "" | Cloud specific bindings (options: aws, gcp, azure) |
| global.labels | object | {} | Global labels deployed to all resources deployed by the chart |
| fullnameOverride | string | "" | Overrides the full-name given to the deployment resources (default: .Release.Name) |
| image.repository | string | "nginx" | |
| image.tag | string | "latest" | |
| image.isRepositoryPublic | bool | true | Whether the repository is public |
| image.pullPolicy | string | "IfNotPresent" | The image pullPolicy to use |
| config.command | list | [] | |
| config.args | list | [] | |
| config.env | string | nil | Map of environment variables to use within the job |
| config.secrets | object | {} | Map of secrets that will be exposed as environment variables within the job |
| config.securityContext | object | {} | Deprecated, use containerSecurityContext. Map of securityContext applied to the container. When non-empty it replaces containerSecurityContext entirely, so existing overrides keep their exact behaviour. |
| config.hostPIDAccess | bool | false | Allow pods access to host proccess information |
| config.hostNetworkAccess | bool | false | Allow pods access to host network () |
| config.dnsPolicy | string | "ClusterFirst" | DNS Policy for pods (https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/) |
| configMaps | list | [] | List of config maps to mount to the deployment |
| daemonsetAnnotations | object | {} | Annotations to be applied to the daemonset |
| hostPaths | list | [] | List of host paths to mount to the deployment |
| extraVolumes | list | [] | Additional volumes to attach to the pod spec. Useful with readOnlyRootFilesystem: true — declare writable scratch space (e.g. emptyDir on /tmp) without disabling the hardened default. |
| extraVolumeMounts | list | [] | Additional volume mounts to attach to the container. Pair with extraVolumes above. |
| resources | object | {} | Map of resource constraints for the service |
| containerSecurityContext | object | {"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"readOnlyRootFilesystem":false,"runAsNonRoot":true,"seccompProfile":{"type":"RuntimeDefault"}} | Container security context configuration. These defaults follow kubesec.io best practices for hardened deployments. runAsUser / runAsGroup are intentionally not pinned; the image's USER directive selects the runtime UID while runAsNonRoot: true still enforces the non-root invariant. readOnlyRootFilesystem defaults to false so existing deployments are not broken on upgrade. Node agents that need root, host access or extra capabilities must override these, e.g. runAsNonRoot: false or capabilities.add. config.securityContext, when set, takes precedence. |
| terminationGracePeriodSeconds | int | 60 | Grace period for termination of the service |
| tolerations | list | [{"operator":"Exists"}] | Tolerations for the daemonset pods. Defaults to tolerating all taints so the daemonset is scheduled onto every node in the cluster, including tainted nodes (e.g. Karpenter-provisioned nodes). Set to [] to disable and use default scheduling. |
| nodeSelector | object | {} | Node selector for constraining the daemonset to specific nodes |
| affinity | object | {} | Affinity rules for the daemonset pods |
| service.deploy | bool | true | |
| service.type | string | "NodePort" | Whether to setup service bindings |
| service.name | string | "http" | Name of service |
| service.port | int | 8000 | Port to bind and expose the service on |
| service.targetPort | int | 80 | The Target Port that the actual application is being exposed on |
| service.protocol | string | "TCP" | Protocol that the service leverages (note: TCP or UDP) |
| dockerconfigjson.name | string | "snowplow-sd-dockerhub" | Name of the secret to use for the private repository |
| dockerconfigjson.username | string | "" | Username for the private repository |
| dockerconfigjson.password | string | "" | Password for the private repository |
| dockerconfigjson.server | string | "https://index.docker.io/v1/" | Repository server URL |
| dockerconfigjson.email | string | "" | Email address for user of the private repository |
| cloudserviceaccount.deploy | bool | false | Whether to create a service-account |
| cloudserviceaccount.name | string | "snowplow-sd-service-account" | Name of the service-account to create |
| cloudserviceaccount.aws.roleARN | string | "" | IAM Role ARN to bind to the k8s service account |
| cloudserviceaccount.gcp.serviceAccount | string | "" | Service Account email to bind to the k8s service account |
| cloudserviceaccount.azure.managedIdentityId | string | "" | Workload managed identity id to bind to the k8s service account |
| clusterrole.deploy | bool | false | Whether to create a cluster role |
| clusterrole.rules | list | [] | List of PolicyRules to attach to cluster role |
Deploy daemonset with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has daemonset 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 chartdaemonset is pinned at v0.7.1 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