daemonset

by Snowplow

Helm chartv0.7.1Verified publisher

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

RepositoryNameVersion
https://snowplow-devops.github.io/helm-chartscloudserviceaccount0.3.0
https://snowplow-devops.github.io/helm-chartsdockerconfigjson0.1.0

Values

KeyTypeDefaultDescription
global.cloudstring""Cloud specific bindings (options: aws, gcp, azure)
global.labelsobject{}Global labels deployed to all resources deployed by the chart
fullnameOverridestring""Overrides the full-name given to the deployment resources (default: .Release.Name)
image.repositorystring"nginx"
image.tagstring"latest"
image.isRepositoryPublicbooltrueWhether the repository is public
image.pullPolicystring"IfNotPresent"The image pullPolicy to use
config.commandlist[]
config.argslist[]
config.envstringnilMap of environment variables to use within the job
config.secretsobject{}Map of secrets that will be exposed as environment variables within the job
config.securityContextobject{}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.hostPIDAccessboolfalseAllow pods access to host proccess information
config.hostNetworkAccessboolfalseAllow pods access to host network ()
config.dnsPolicystring"ClusterFirst"DNS Policy for pods (https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/)
configMapslist[]List of config maps to mount to the deployment
daemonsetAnnotationsobject{}Annotations to be applied to the daemonset
hostPathslist[]List of host paths to mount to the deployment
extraVolumeslist[]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.
extraVolumeMountslist[]Additional volume mounts to attach to the container. Pair with extraVolumes above.
resourcesobject{}Map of resource constraints for the service
containerSecurityContextobject{"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.
terminationGracePeriodSecondsint60Grace period for termination of the service
tolerationslist[{"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.
nodeSelectorobject{}Node selector for constraining the daemonset to specific nodes
affinityobject{}Affinity rules for the daemonset pods
service.deploybooltrue
service.typestring"NodePort"Whether to setup service bindings
service.namestring"http"Name of service
service.portint8000Port to bind and expose the service on
service.targetPortint80The Target Port that the actual application is being exposed on
service.protocolstring"TCP"Protocol that the service leverages (note: TCP or UDP)
dockerconfigjson.namestring"snowplow-sd-dockerhub"Name of the secret to use for the private repository
dockerconfigjson.usernamestring""Username for the private repository
dockerconfigjson.passwordstring""Password for the private repository
dockerconfigjson.serverstring"https://index.docker.io/v1/"Repository server URL
dockerconfigjson.emailstring""Email address for user of the private repository
cloudserviceaccount.deployboolfalseWhether to create a service-account
cloudserviceaccount.namestring"snowplow-sd-service-account"Name of the service-account to create
cloudserviceaccount.aws.roleARNstring""IAM Role ARN to bind to the k8s service account
cloudserviceaccount.gcp.serviceAccountstring""Service Account email to bind to the k8s service account
cloudserviceaccount.azure.managedIdentityIdstring""Workload managed identity id to bind to the k8s service account
clusterrole.deployboolfalseWhether to create a cluster role
clusterrole.ruleslist[]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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartdaemonset is pinned at v0.7.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. 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