1

I am working on Deploying laravel application on Kubernetes which is connected by glusterfs to storage this is my structure enter image description here

every pod has the application inside it,

the storage folder in Laravel Application has been mounted to the glusterfs under this path /mnt/Kubernates

this is my glusterfs endpoints YAML file

    apiVersion: v1
    kind: Endpoints
    metadata:
      name: glusterfs-cluster
      labels:
        storage.k8s.io/name: glusterfs
        storage.k8s.io/part-of: kubernetes-complete-reference
        storage.k8s.io/created-by: ssbostan
    subsets:
      - addresses:
          - ip: 10.50.1.75
            hostname: gs1
          - ip: 10.50.1.85
            hostname: gs2
          - ip: 10.50.1.95
            hostname: gs3
        ports:
          - port: 1


this is my  deployment file  for PHP 

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: php
  name: qulakphp
  namespace: default
spec:
  replicas: 10
  selector:
    matchLabels:
      app: php
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: php
    spec:
      containers:
        - name: qulak-php-fpm
          image: phpimage
          imagePullPolicy: Always
          workingDir: /var/www/html
          livenessProbe:
            initialDelaySeconds: 10
            periodSeconds: 15
            timeoutSeconds: 30
            tcpSocket:
              port: 9000
          readinessProbe:
            initialDelaySeconds: 10
            periodSeconds: 10
            tcpSocket:
              port: 9000
          envFrom:
          - configMapRef:
              name: qulak-config
          lifecycle:
            postStart:
              exec:
                 command: ["/bin/sh", "-c", "php artisan storage:link  ","php artisan view:clear","php artisan cache:clear","php artisan config:clear","php artisan migrate"]
                # command: ["composer","--no-dev","update"]
          ports:
            - containerPort: 9000
          envFrom:
          - configMapRef:
              name: qulak-config
          lifecycle:
            postStart:
              exec:
                 command: ["/bin/sh", "-c", "php artisan storage:link  ","php artisan view:clear","php artisan cache:clear","php artisan config:clear","php artisan migrate"]
                # command: ["composer","--no-dev","update"]
          ports:
            - containerPort: 9000
          volumeMounts:
            - name: php-storage
              mountPath: /var/www/html/storage
            - name: php-configmap
              mountPath: /usr/local/etc/php-fpm.d/www.conf
              subPath: www.conf
            - name: qulak-configmap
              mountPath: /var/www/html/.env
              subPath: .env


   volumes:
      - name: php-storage
        glusterfs:
           endpoints: glusterfs-cluster
           path: KUBERNATES
           readOnly: false

the system is working perfectly for some times then it is not responding and giving me 504 Gateway time out error, then if I tried from another device or from another browser it is working for sometimes then it not responding, but if I disabled the glusterfs on my pod it is working perfectly without any error, I don't know if there are any missed configuration that I have to do, I researched a lot on the internet but I could not find any solution.

Ahmed Homs
  • 11
  • 1

0 Answers0