Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nginx-php fails health check with persistance enabled #4

Closed
truxnell opened this issue Jun 13, 2021 · 3 comments · Fixed by #5
Closed

Nginx-php fails health check with persistance enabled #4

truxnell opened this issue Jun 13, 2021 · 3 comments · Fixed by #5

Comments

@truxnell
Copy link

I've just used/setup the nginx-php helm chart and encountered a issue.

I noted that it works fine when not using a persistent volume, but the NGINX container fails its health check on health.php with a 404 when using a existing claim persistent volume.
I found that health.php was missing when using a persistent volume, and I fixed mine by just creating the file manually (via vscode attached to the the working php container)

This makes sense to me as I suspect the pvc mount is overwriting the configmap health.php, causing a fail for the liveness check.

Suggestions to fix:

  1. Put a callout in the docs that you have to create the health.php manually if you use a persistent volume (easyiest)
  2. Rework the helm to apply the health.php over the top of the pvc mount data
  3. Mount the configmap to a separate directory, and startup script to copy the health.php over to the /var/www/html directory if missing.

Apologies for not raising a PR to fix, but I'm not versed enough in helm to know the best approach.

@truxnell
Copy link
Author

My config:

nginx-php.yaml

---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: nginx-phpfm
spec:
  interval: 5m
  chart:
    spec:
      chart: nginx-phpfpm
      version: 0.0.2
      sourceRef:
        kind: HelmRepository
        name: drpsychick-charts
        namespace: flux-system
      interval: 5m
  # Values link: 
  values:
    nginx:
      image:
        tag: "1.21.0"
    phpfpm:
      image:
        tag: "8-fpm-alpine"
    persistence:
      enabled: true
      existingClaim: nginx-php-config-v1

config-php.yaml

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nginx-php-config-v1
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  storageClassName: rook-ceph-block

kustomization.yaml

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: http
resources:
  - config-pvc.yaml
  - nginx-phpfm.yaml
  - ```

@DrPsychick
Copy link
Collaborator

Hey @truxnell , thanks for reporting this!

I would actually prefer to go with option 1

  1. Put a callout in the docs that you have to create the health.php manually if you use a persistent volume (easyiest)

Not because it's easiest, but because the "health" of the service really depends on what you deploy and how you want to report if it is healthy. In the end, the provided health.php was just a "demo" so to say.

Example: if your PHP application requires/uses database access, the health check should fail until the database is accessible.

@DrPsychick
Copy link
Collaborator

Let me know if the merged solution (make the path configurable, so you can use whatever script path you want, to run health checks) works for you @truxnell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants