generic-app

by B3O

Helm chartv0.1.6Verified publisher

Helm chart for deployment generic app on Kubernetes

About this chart

Generic App Chart

  • Get repo
  • Install chart
  • Uninstall chart
  • Using examples
    • Simple use
    • Pratical use
  • Configuration
    • Chart parameters

Get repo

helm repo add b3o https://helm.b3o.io
helm repo update

Install chart:

helm install [RELEASE_NAME] b3o/generic-app

See configuration below.

Uninstall chart

helm uninstall [RELEASE_NAME]

Using examples

Simple use

helm install webserver --set image.name=nginx b3o/generic-app

The above command will deploy a Deployment and Service resources.

We can check this with the below command:

helm get manifest webserver

Manifest output:

---
# Source: generic-app/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
  name: webserver
  labels:
    app: webserver
spec:
  selector:
    app: webserver
  ports:
  - targetPort: 80
    port: 80
---
# Source: generic-app/templates/deployment.yaml
kind: Deployment
apiVersion: apps/v1
metadata:
  name: webserver
  labels:
    app: webserver 
spec:
  replicas: 
  selector:
    matchLabels:
      app: webserver
  template:
    metadata:
      labels:
        app: webserver
    spec:
      containers:
        - name: webserver
          imagePullPolicy: Always
          image: "nginx:latest"
          ports:
          - containerPort: 80
          resources:
            requests:
            limits:

Pratical use

In the example, we are going to execute the Wordpress application + MySQL Database with the same Chart!

Database:

helm install database \
    --set image.name=mariadb \
    --set variables.nonSecret.MYSQL_RANDOM_ROOT_PASSWORD=yes \
    --set variables.nonSecret.MYSQL_DATABASE=wordpress \
    --set variables.nonSecret.MYSQL_USER=username \
    --set variables.secret.MYSQL_PASSWORD=password \
    --set app.containerPort=3306 \
    --set app.servicePort=3306 \
    b3o/generic-app

Wordpress:

helm install wordpress \
    --set image.name=wordpress \
    --set variables.nonSecret.WORDPRESS_DB_HOST=database \
    --set variables.nonSecret.WORDPRESS_DB_NAME=wordpress \
    --set variables.nonSecret.WORDPRESS_DB_USER=username \
    --set variables.secret.WORDPRESS_DB_PASSWORD=password \
    b3o/generic-app

Check with kubectl port-forward:

kubectl port-forward service/wordpress 8080:80

Access http://localhost:8080 and enjoy!

Note: For external access using NGINX Ingress Controller and SSL with Cert-Manager see the Chart Parameters area.

Configuration

Show values

helm show values b3o/generic-app

Chart Parameters

VariableDescriptionDefault value
app.servicePortService expose port80
app.containerPortContainer expose port80
deployment.memoryRequestMinimal memory request for applicationnull
deployment.cpuRequestMinimal cpu request for applicationnull
deployment.memoryLimitMaximum memory request for applicationnull
deployment.cpuLimitMaximum cpu request for applicationnull
strategy.typeSpecifies the strategy used to replace old Pods by new onesRollingUpdate
strategy.rollingUpdate.maxUnavailableDeployment ensures that only a certain number of Pods are down while they are being updated. By default, it ensures that at least 75% of the desired number of Pods are up (25% max unavailable)25%
strategy.rollingUpdate.maxSurgeDeployment also ensures that only a certain number of Pods are created above the desired number of Pods. By default, it ensures that at most 125% of the desired number of Pods are up (25% max surge).25%
image.repository.nameRepository of imagenull
image.repository.isPrivateIf repository is privatefalse
image.repository.secretNameIf image.repository.isPrivate is true to define secret name with auth for reponull
image.nameName of imagecontainous/whoami
image.tagTag of imagelatest
image.pullPolicyPolicy of download of imageAlways
ingress.enabledEnable ingress resource (for nginx ingress controller)false
ingress.hostNameDefine FQDN access for web application (to configure DNS)null
ingress.sslRedirectEnable redirect for ssl (for nginx ingress controller)false
ingress.nginxControllerIf use nginx linke ingress controllerfalse
ingress.certManager.enabledEnable cert-manager annotationfalse
ingress.certManager.clusterIssuerNameCluster Issuer Name for cert-managerletsencrypt
variables.secretTo create SECRET variables on deployment{}
variables.nonSecretTo create NON SECRET variables on deployment{}
hpa.enabledEnable horizontal pod autoscalerfalse
hpa.minReplicasMinimal replicas in execution1
hpa.maxReplicasMaximum replicas in execution2
hpa.avgCpuUtilizationPercentage cpu value that will trigger horizontal scaling50
startupProbe.enabledEnable startup probefalse
startupProbe.httpGet.pathPath for get http probe/
startupProbe.periodSecondsHow often (in seconds) to perform the probe10
startupProbe.failureThresholdWhen a probe fails, Kubernetes will try failureThreshold times before giving up20
startupProbe.timeoutSecondsNumber of seconds after which the probe times out1
readinessProbe.enabledEnable readiness probefalse
readinessProbe.httpGet.pathPath for get http probe/
readinessProbe.initialDelaySecondsTells the kubelet that it should wait N seconds20
readinessProbe.periodSecondsHow often (in seconds) to perform the probe30
readinessProbe.failureThresholdWhen a probe fails, Kubernetes will try failureThreshold times before giving up. In case of readiness probe the Pod will be marked Unready2
readinessProbe.timeoutSecondsNumber of seconds after which the probe times out3
livenessProbe.enabledEnable liveness probefalse
livenessProbe.httpGet.pathPath for get http probe/
livenessProbe.initialDelaySecondsTells the kubelet that it should wait N seconds20
livenessProbe.periodSecondsHow often (in seconds) to perform the probe60
livenessProbe.failureThresholdWhen a probe fails, Kubernetes will try failureThreshold times before giving up. Giving up in case of liveness probe means restarting the container1
livenessProbe.timeoutSecondsNumber of seconds after which the probe times out3

More details regarding the probes (startup, readiness and liveness) can be found in the official documentation here:
https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/

Deploy generic-app with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has generic-app 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 chartgeneric-app is pinned at v0.1.6 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