nginx
by CloudPirates
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
| Parameter | Description | Default |
|---|---|---|
global.imageRegistry | Global Docker Image registry | "" |
global.imagePullSecrets | Global Docker registry secret names as an array | [] |
Common Parameters
| Parameter | Description | Default |
|---|---|---|
nameOverride | String to partially override nginx.fullname | "" |
fullnameOverride | String to fully override nginx.fullname | "" |
namespaceOverride | String to override the namespace for all resources | "" |
commonLabels | Labels to add to all deployed objects | {} |
commonAnnotations | Annotations to add to all deployed objects | {} |
Deployment Parameters
| Parameter | Description | Default |
|---|---|---|
replicaCount | Number of Nginx replicas to deploy | 1 |
revisionHistoryLimit | Number of revisions to keep in history for rollback | 10 |
Nginx Image Parameters
| Parameter | Description | Default |
|---|---|---|
image.registry | Nginx image registry | docker.io |
image.repository | Nginx image repository | nginx |
image.tag | Nginx image tag | "1.29.4-alpine@sha256:1e462d5b3fe0bc6647a9fbba5f47924b771254763e8a51b638842890967e477e" |
image.pullPolicy | Nginx image pull policy | Always |
Git Image Parameters
Used by the git-clone-repository init container and the git-repo-syncer sidecar when cloneStaticSiteFromGit.enabled is set.
| Parameter | Description | Default |
|---|---|---|
cloneStaticSiteFromGit.image.registry | Git image registry | docker.io |
cloneStaticSiteFromGit.image.repository | Git image repository | alpine/git |
cloneStaticSiteFromGit.image.tag | Git image tag | v2.52.0 |
cloneStaticSiteFromGit.image.pullPolicy | Git image pull policy | IfNotPresent |
cloneStaticSiteFromGit.image.pullSecrets | Git image pull secrets | [] |
Nginx Configuration Parameters
Existing Configmaps are prioritized over inline configuration. Inline configuration will trigger a pod restart if changed.
| Parameter | Description | Default |
|---|---|---|
config | Custom NGINX configuration file (nginx.conf) | "" |
existingConfigConfigmap | Name of an existing ConfigMap containing nginx.conf | "" |
serverConfig | Custom server block to be added to NGINX configuration | "" |
existingServerConfigConfigmap | Name of an existing ConfigMap containing server-config.conf | "" |
streamServerConfig | Custom stream server block to be added to NGINX config | "" |
existingStreamServerConfigConfigmap | Name 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
| Parameter | Description | Default |
|---|---|---|
containerPorts | Array 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
| Parameter | Description | Default |
|---|---|---|
service.type | Nginx service type | ClusterIP |
service.ports | Array of service ports (advanced configuration) - see examples | [] |
service.clusterIP | Kubernetes service static ClusterIP | "" |
service.internalTrafficPolicy | Kubernetes service internal traffic policy | Cluster |
service.trafficDistribution | Kubernetes service traffic distribution | "" |
service.annotations | Additional 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
| Parameter | Description | Default |
|---|---|---|
podSecurityContext.fsGroup | Set Nginx pod's Security Context fsGroup | 101 |
containerSecurityContext.runAsUser | Set Nginx container's Security Context runAsUser | 101 |
containerSecurityContext.runAsNonRoot | Set Nginx container's Security Context runAsNonRoot | true |
containerSecurityContext.allowPrivilegeEscalation | Set Nginx container's privilege escalation | false |
Resources Parameters
| Parameter | Description | Default |
|---|---|---|
resources | Resource limits and requests for Nginx pod | {} |
lifecycleHooks | for the Nginx container to automate configuration before or after startup | {} |
Health Check Parameters
| Parameter | Description | Default |
|---|---|---|
livenessProbe.enabled | Enable liveness probe | true |
livenessProbe.type | Probe type (tcpSocket or httpGet) | tcpSocket |
livenessProbe.path | Path for HTTP probe (only used when type is httpGet) | / |
livenessProbe.initialDelaySeconds | Initial delay before starting probes | 30 |
livenessProbe.periodSeconds | How often to perform the probe | 10 |
livenessProbe.timeoutSeconds | Timeout for each probe attempt | 5 |
livenessProbe.failureThreshold | Number of failures before pod is restarted | 3 |
livenessProbe.successThreshold | Number of successes to mark probe as successful | 1 |
readinessProbe.enabled | Enable readiness probe | true |
readinessProbe.type | Probe type (tcpSocket or httpGet) | tcpSocket |
readinessProbe.path | Path for HTTP probe (only used when type is httpGet) | / |
readinessProbe.initialDelaySeconds | Initial delay before starting probes | 5 |
readinessProbe.periodSeconds | How 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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartnginx is pinned at v0.16.20 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