nginx

by CloudPirates

Helm chartv0.16.20App 1.31.9Apache-2.0Verified publisher

Nginx is a high-performance HTTP server and reverse proxy.

About this chart

Nginx

nginx ("engine x") is an HTTP web server, reverse proxy, content cache, load balancer, TCP/UDP proxy server, and mail proxy server.

Installing the Chart

To install the chart with the release name my-nginx:

helm install my-nginx oci://registry-1.docker.io/cloudpirates/nginx

To install with custom values:

helm install my-nginx oci://registry-1.docker.io/cloudpirates/nginx -f my-values.yaml

Uninstalling the Chart

To uninstall/delete the my-nginx deployment:

helm uninstall my-nginx

This removes all the Kubernetes components associated with the chart and deletes the release.

Security & Signature Verification

This Helm chart is cryptographically signed with Cosign to ensure authenticity and prevent tampering.

Public Key:

-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE5U+rM2d3hDjgP5T3cLShuuQIU9vR
Z4/G+Nug6q5vRa+C3qUA1wXjbaJFAfcIrv5VjmYAYOj13shnPpp3Zh4fnQ==
-----END PUBLIC KEY-----

To verify the helm chart before installation, copy the public key to the file cosign.pub and run cosign:

cosign verify --key cosign.pub registry-1.docker.io/cloudpirates/nginx:<version>

Common Use Cases

Custom Container Port (e.g., 8080)

To run Nginx on port 8080 with matching health checks:

# my-values.yaml
containerPorts:
  - name: http
    containerPort: 8080
    protocol: TCP
serverConfig: |
  server {
    listen 0.0.0.0:8080;
    root /usr/share/nginx/html;
    index index.html index.htm;

    location / {
      try_files $uri $uri/ /index.html;
    }
  }
livenessProbe:
  type: httpGet
  path: /
readinessProbe:
  type: httpGet
  path: /

Then install with:

helm install my-nginx oci://registry-1.docker.io/cloudpirates/nginx -f my-values.yaml

Multiple Ports Configuration

For advanced setups with multiple ports:

# advanced-values.yaml
containerPorts:
  - name: http
    containerPort: 80
    protocol: TCP
  - name: https
    containerPort: 443
    protocol: TCP
service:
  ports:
    - port: 80
      targetPort: http
      protocol: TCP
      name: http
    - port: 443
      targetPort: https
      protocol: TCP
      name: https

Cloning a Static Site from Git Using an SSH Key

podSecurityContext.fsGroup defaults to 101 and applies to all volumes in the pod, including any extraVolumes you mount yourself. If you mount an SSH private key as a Secret for cloneStaticSiteFromGit (or any other Git-over-SSH use case), Git/SSH will still reject the key even if you set a restrictive defaultMode such as 0600, because the file's group ownership is changed to 101 and the permission bits end up looking like 0640 to SSH.

To fix this, either set the secret's defaultMode to 0640 so the group-owned permissions are what SSH expects:

# my-values.yaml
extraVolumes:
  - name: git-credential-ssh-key
    secret:
      secretName: git-credential-ssh-key
      defaultMode: 0640
extraVolumeMounts:
  - name: git-credential-ssh-key
    mountPath: /root/.ssh/
    readOnly: true
cloneStaticSiteFromGit:
  enabled: true
  repository: [email protected]:my-org/my-site.git
  branch: main

or unset podSecurityContext.fsGroup if your workload doesn't otherwise need it:

# my-values.yaml
podSecurityContext:
  fsGroup: null

Cloning a Static Site from Git with a Build Output Subdirectory

If your repository puts the rendered site in a subdirectory (e.g. a Hugo or Zola site pre-built into public/), set cloneStaticSiteFromGit.subPath to serve only that subdirectory as the web root instead of the whole repository. The Git init/sync containers still clone the full repository; only the nginx container's mount is scoped to the subdirectory:

# my-values.yaml
cloneStaticSiteFromGit:
  enabled: true
  repository: https://example.com/my-org/my-site.git
  branch: main
  subPath: public

Note that this does not run a build step (e.g. hugo build) inside the container — the subdirectory must already contain the built output in the repository.

Configuration

The following table lists the configurable parameters of the Nginx chart and their default values.

Global Parameters

ParameterDescriptionDefault
global.imageRegistryGlobal Docker Image registry""
global.imagePullSecretsGlobal Docker registry secret names as an array[]

Common Parameters

ParameterDescriptionDefault
nameOverrideString to partially override nginx.fullname""
fullnameOverrideString to fully override nginx.fullname""
namespaceOverrideString to override the namespace for all resources""
commonLabelsLabels to add to all deployed objects{}
commonAnnotationsAnnotations to add to all deployed objects{}

Deployment Parameters

ParameterDescriptionDefault
replicaCountNumber of Nginx replicas to deploy1
revisionHistoryLimitNumber of revisions to keep in history for rollback10

Nginx Image Parameters

ParameterDescriptionDefault
image.registryNginx image registrydocker.io
image.repositoryNginx image repositorynginx
image.tagNginx image tag"1.29.4-alpine@sha256:1e462d5b3fe0bc6647a9fbba5f47924b771254763e8a51b638842890967e477e"
image.pullPolicyNginx image pull policyAlways

Git Image Parameters

Used by the git-clone-repository init container and the git-repo-syncer sidecar when cloneStaticSiteFromGit.enabled is set.

ParameterDescriptionDefault
cloneStaticSiteFromGit.image.registryGit image registrydocker.io
cloneStaticSiteFromGit.image.repositoryGit image repositoryalpine/git
cloneStaticSiteFromGit.image.tagGit image tagv2.52.0
cloneStaticSiteFromGit.image.pullPolicyGit image pull policyIfNotPresent
cloneStaticSiteFromGit.image.pullSecretsGit image pull secrets[]

Nginx Configuration Parameters

Existing Configmaps are prioritized over inline configuration. Inline configuration will trigger a pod restart if changed.

ParameterDescriptionDefault
configCustom NGINX configuration file (nginx.conf)""
existingConfigConfigmapName of an existing ConfigMap containing nginx.conf""
serverConfigCustom server block to be added to NGINX configuration""
existingServerConfigConfigmapName of an existing ConfigMap containing server-config.conf""
streamServerConfigCustom stream server block to be added to NGINX config""
existingStreamServerConfigConfigmapName of an existing ConfigMap containing stream-server-config.conf""

Example of an existing external config:

apiVersion: v1
kind: ConfigMap
metadata:
  name: example-nginx-config
data:
  nginx.conf: |-
    user  nginx;
    worker_processes  1;
    error_log  /var/log/nginx/error.log warn;
    pid        /run/nginx.pid;

    events {
        worker_connections  1024;
    }
    http {
        include       /etc/nginx/mime.types;
        default_type  application/octet-stream;
        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for"';
        access_log  /var/log/nginx/access.log  main;
        sendfile        on;
        keepalive_timeout  65;
        include /etc/nginx/conf.d/*.conf;
    }

Container Port Parameters

ParameterDescriptionDefault
containerPortsArray of container ports (advanced configuration) - see examples[]

Container Ports Examples

Multiple ports (advanced):

containerPorts:
  - name: http
    containerPort: 80
    protocol: TCP
  - name: https
    containerPort: 443
    protocol: TCP

Service Parameters

ParameterDescriptionDefault
service.typeNginx service typeClusterIP
service.portsArray of service ports (advanced configuration) - see examples[]
service.clusterIPKubernetes service static ClusterIP""
service.internalTrafficPolicyKubernetes service internal traffic policyCluster
service.trafficDistributionKubernetes service traffic distribution""
service.annotationsAdditional annotations to add to the service{}

Service Ports Examples

Multiple service ports (advanced):

service:
  ports:
    - port: 80
      targetPort: nginx
      protocol: TCP
      name: http
    - port: 443
      targetPort: https
      protocol: TCP
      name: https

Security Context Parameters

ParameterDescriptionDefault
podSecurityContext.fsGroupSet Nginx pod's Security Context fsGroup101
containerSecurityContext.runAsUserSet Nginx container's Security Context runAsUser101
containerSecurityContext.runAsNonRootSet Nginx container's Security Context runAsNonRoottrue
containerSecurityContext.allowPrivilegeEscalationSet Nginx container's privilege escalationfalse

Resources Parameters

ParameterDescriptionDefault
resourcesResource limits and requests for Nginx pod{}
lifecycleHooksfor the Nginx container to automate configuration before or after startup{}

Health Check Parameters

ParameterDescriptionDefault
livenessProbe.enabledEnable liveness probetrue
livenessProbe.typeProbe type (tcpSocket or httpGet)tcpSocket
livenessProbe.pathPath for HTTP probe (only used when type is httpGet)/
livenessProbe.initialDelaySecondsInitial delay before starting probes30
livenessProbe.periodSecondsHow often to perform the probe10
livenessProbe.timeoutSecondsTimeout for each probe attempt5
livenessProbe.failureThresholdNumber of failures before pod is restarted3
livenessProbe.successThresholdNumber of successes to mark probe as successful1
readinessProbe.enabledEnable readiness probetrue
readinessProbe.typeProbe type (tcpSocket or httpGet)tcpSocket
readinessProbe.pathPath for HTTP probe (only used when type is httpGet)/
readinessProbe.initialDelaySecondsInitial delay before starting probes5
readinessProbe.periodSecondsHow often to perform the

Deploy nginx with OpenTenant

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