common

by wasilak

Helm chartv1.2.9App 1.2.9deprecated_GPL-3.0+Verified publisher

A comprehensive, production-ready Helm chart for deploying applications on Kubernetes

About this chart

common

A comprehensive, production-ready Helm chart for deploying applications on Kubernetes

Homepage: https://github.com/wasilak/common-chart

Overview

The Common Chart is a comprehensive, production-ready Helm chart for deploying applications on Kubernetes. It provides a flexible, battle-tested foundation for deploying Deployments, StatefulSets, and DaemonSets with sensible defaults and extensive customization options.

Features

  • Multiple Workload Types: Support for Deployment, StatefulSet, and DaemonSet configurations
  • Security First: Pod Security Context, Container Security Context, and RBAC support
  • Storage Management: Persistent volumes, ConfigMaps, and EmptyDir volumes
  • Advanced Networking: Ingress support with domain redirect middleware for Traefik
  • Observability: ServiceMonitor integration for Prometheus and distributed tracing (Jaeger, Datadog)
  • Authentication: Forward auth with Authelia support
  • Resource Management: CPU/Memory limits and requests with Pod Disruption Budgets
  • Health Checks: Startup, Liveness, and Readiness probes
  • Environment Configuration: Flexible environment variables and secrets management
  • Container Lifecycle: Pre-stop and post-start hooks
  • Sidecar Support: Logging sidecars and custom sidecars
  • HTTPS Ready: Built-in HTTPS redirect support

Installation

Prerequisites

  • Kubernetes 1.19+
  • Helm 3.0+
  • kubectl configured to access your cluster

Quick Start

Add the Helm repository and install the chart:

# Add repository (when OCI publishing is complete)
helm repo add common-chart oci://ghcr.io/wasilak/common-chart

# Install the chart
helm install my-app common-chart/common \
  --set image.repository=my-image \
  --set image.tag=v1.0.0

Using Custom Values

Create a values.yaml file with your custom configuration:

image:
  repository: my-app
  tag: "1.0.0"
  pullPolicy: IfNotPresent

deployment:
  replicaCount: 3

service:
  type: LoadBalancer

resources:
  limits:
    cpu: 500m
    memory: 512Mi
  requests:
    cpu: 250m
    memory: 256Mi

ingress:
  hosts:
    - host: my-app.example.com
      paths:
        - path: /
          pathType: Prefix

Then install with your custom values:

helm install my-app common-chart/common -f values.yaml

Configuration Examples

Enable High Availability

deployment:
  replicaCount: 3
  strategy: RollingUpdate

podDisruptionBudget:
  enabled: true
  minAvailable: 1

affinity:
  podAntiAffinity:
    preferredDuringSchedulingIgnoredDuringExecution:
      - weight: 100
        podAffinityTerm:
          labelSelector:
            matchExpressions:
              - key: app
                operator: In
                values:
                  - my-app
          topologyKey: kubernetes.io/hostname

Enable Resource Limits

resources:
  limits:
    cpu: "1000m"
    memory: "1Gi"
  requests:
    cpu: "500m"
    memory: "512Mi"

Enable RBAC and ServiceAccount

rbac:
  create: true
  rules:
    - apiGroups: [""]
      resources: ["pods"]
      verbs: ["get", "list", "watch"]

serviceAccount:
  create: true
  name: my-app

Configure Storage

storage:
  persistence:
    - name: data
      enabled: true
      size: 10Gi
      storageClassName: fast-ssd
      accessModes:
        - ReadWriteOnce

volumeMounts:
  - name: data
    mountPath: /data

Enable Health Checks

livenessProbeEnabled: true
livenessProbe:
  httpGet:
    path: /health
    port: http
  initialDelaySeconds: 10
  periodSeconds: 10
  failureThreshold: 3

readinessProbeEnabled: true
readinessProbe:
  httpGet:
    path: /ready
    port: http
  initialDelaySeconds: 5
  periodSeconds: 5
  failureThreshold: 3

Access Instructions

ClusterIP Service (Default)

For ClusterIP service access, use port-forward:

kubectl port-forward svc/my-app 8080:80
# Access the application at http://localhost:8080

NodePort Service

For NodePort service access, get the node IP and port:

kubectl get svc my-app -o jsonpath='{.status.nodePort}'
# Access at http://<node-ip>:<nodePort>

LoadBalancer Service

For LoadBalancer service access, get the external IP:

kubectl get svc my-app -o jsonpath='{.status.loadBalancer.ingress[0].ip}'
# Access at http://<external-ip>

Ingress

For Ingress access, ensure the hostname is configured and accessible:

kubectl get ingress my-app
# Access at https://my-app.example.com (or configured hostname)

Upgrading

To upgrade an existing release:

helm upgrade my-app common-chart/common -f values.yaml

Uninstalling

To uninstall the chart:

helm uninstall my-app

RBAC

This chart can optionally create RBAC resources (ServiceAccount, ClusterRole, ClusterRoleBinding) to grant the application necessary permissions.

To enable RBAC:

rbac:
  create: true
  rules:
    - apiGroups: [""]
      resources: ["pods", "services"]
      verbs: ["get", "list", "watch"]

Troubleshooting

Pod not starting

Check pod status and logs:

kubectl get pods -l app=my-app
kubectl logs -f deployment/my-app
kubectl describe pod <pod-name>

Service not accessible

Verify service configuration:

kubectl get svc my-app
kubectl get endpoints my-app

Health check failures

Check probe configuration and application logs:

kubectl logs -f deployment/my-app
kubectl describe pod <pod-name>

Image pull errors

Verify image repository and pull secrets:

image:
  repository: your-registry/image
  pullSecrets:
    - name: registry-credentials

Persistent volume issues

Check PVC and storage class:

kubectl get pvc
kubectl get storageclass
kubectl describe pvc <pvc-name>

Support

For issues, feature requests, or questions:

Maintainers

NameEmailUrl
wasilak[email protected]

Source Code

Chart Values

Values

KeyTypeDefaultDescription
typestring"deployment"
deployment.replicaCountint1
deployment.strategystring"RollingUpdate"
statefulset.replicaCountint1
statefulset.podManagementPolicystring"OrderedReady"
statefulset.updateStrategy.typestring"RollingUpdate"
statefulset.updateStrategy.rollingUpdate.partitionint0
statefulset.volumeClaimTemplateslist[]
daemonset.updateStrategy.typestring"RollingUpdate"
daemonset.updateStrategy.rollingUpdate.maxUnavailableint1
domainRedirectlist[]
customSubdomainstring""
labelsobject{}
podLabelsobject{}
annotationsobject{}
podAnnotationsobject{}
nodeSelectorobject{}
tolerationslist[]
affinityobject{}
resourcesobject{}
envlist[]
envFromlist[]
storage.persistencelist[]
volumeMountslist[]
volumes.emptyDirlist[]
volumes.hostPathlist[]
volumes.configMaplist[]
volumes.secretlist[]
initContainerslist[]
lifecycle.preStopobject{}
lifecycle.postStartobject{}
sidecarslist[]
configMapslist[]
podDisruptionBudget.enabledboolfalse
podDisruptionBudget.minAvailablestringnil
podDisruptionBudget.maxUnavailableint1
rbac.createboolfalse
rbac.ruleslist[]
hostNetworkboolfalse
enableServiceLinksbooltrue
dnsPolicystring"ClusterFirst"
podSecurityContext.runAsUserint1000
podSecurityContext.runAsGroupint3000
podSecurityContext.fsGroupint2000
podSecurityContext.fsGroupChangePolicystring"OnRootMismatch"
containerSecurityContext.allowPrivilegeEscalationboolfalse
containerSecurityContext.readOnlyRootFilesystembooltrue
containerSecurityContext.privilegedboolfalse
containerSecurityContext.runAsNonRootbooltrue
containerSecurityContext.runAsUserint1000
containerSecurityContext.runAsGroupint3000
containerSecurityContext.capabilities.drop[0]string"ALL"
containerSecurityContext.seccompProfile.typestring"RuntimeDefault"
image.registrystring"docker.io"
image.repositorystring""
image.pullPolicystring"IfNotPresent"
image.tagstring""
image.digeststring""
image.pullSecretslist[]
serviceAccount.createboolfalse
serviceAccount.namestring""
serviceAccount.annotationsobject{}
service.typestring"ClusterIP"
service.externalTrafficPolicystring"Cluster"
ports[0].namestring"http"
ports[0].containerPortint2000
ports[0].servicePortint2000
ports[0].protocolstring"TCP"
ports[0].ingress[0].hoststring"example.com"
ports[0].ingress[0].paths[0].pathstring"/"
ports[0].ingress[0].paths[0].pathTypestring"Prefix"
ports[0].scrape.enabledboolfalse
ports[0].scrape.pathstring"/metrics"
commandlist[]
argslist[]
startupProbeEnabledboolfalse
startupProbe.httpGet.pathstring"/health"
startupProbe.httpGet.portstring"http"
startupProbe.initialDelaySecondsint0
startupProbe.periodSecondsint10
startupProbe.timeoutSecondsint1
startupProbe.failureThresholdint30
startupProbe.successThresholdint1
livenessProbeEnabledbooltrue
livenessProbe.httpGet.pathstring"/health"
livenessProbe.httpGet.portstring"http"
livenessProbe.initialDelaySecondsint10
livenessProbe.periodSecondsint10
livenessProbe.timeoutSecondsint2
livenessProbe.failureThresholdint3
livenessProbe.successThresholdint1
readinessProbeEnabledbooltrue
readinessProbe.httpGet.pathstring"/health"
readinessProbe.httpGet.portstring"http"
readinessProbe.initialDelaySecondsint5
readinessProbe.periodSecondsint5
readinessProbe.timeoutSecondsint2
readinessProbe.failureThresholdint3
readinessProbe.successThresholdint1
auth.enabledboolfalse
auth.typestring"forwardauth-authelia"
auth.oidc.secretNamestring"external-secret"
auth.urlstring"http://authelia-otteryak-foo.kube-system.svc.cluster.local:9091/api/authz/forward-auth"
https.enabledbooltrue
https.redirectbooltrue
externalSecret.enabledboolfalse
serviceMonitor.enabledboolfalse
serviceMonitor.namespacestring"observability"
tracing.enabledboolfalse
tracing.jaeger.agentHoststring"jaeger-agent.observability.svc.cluster.local"
tracing.jaeger.agentPortint6831
tracing.datadog.enabledboolfalse
tracing.datadog.agentHoststring"datadog-agent.datadog.svc.cluster.local"
tracing.datadog.agentPortint8126
logging.sidecarslist[]

Deploy common with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has common 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 chartcommon is pinned at v1.2.9 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