I am trying to deploy gitea with the help of the helm chart and I am using the microk8s in CentOS environment, but I am unable to deploy gitea.

First I cloned the gitea helm chart using the command : git clone https://gitea.com/gitea/helm-chart.git

After that I changed storage class value in the values.yaml to set the default storage to the microk8s-hostpath

persistence:
  enabled: true
  # existingClaim:
  size: 10Gi
  accessModes:
    - ReadWriteOnce
  labels: {}
  annotations: {}
  storageClass: microk8s-hostpath
  # subPath:

Now I ran the helm install command -> helm install --dependency-update gitea . -f values.yaml

The pods are running fine except the gitea pod

default       gitea-memcached-79c5884c97-62khj           1/1     Running                 0                25h
default       gitea-postgresql-0                         1/1     Running                 0                25h
default       gitea-0                                    0/1     Init:CrashLoopBackOff   294 (4m1s ago)   25h

So I checked the output of the gitea pod describe command ant the output is

 microk8s kubectl describe pod gitea-0
Name:         gitea-0
Namespace:    default
Priority:     0
Node:         testlab01-c01/10.165.188.147
Start Time:   Wed, 20 Apr 2022 06:27:05 +0000
Labels:       app=gitea
              app.kubernetes.io/instance=gitea
              app.kubernetes.io/managed-by=Helm
              app.kubernetes.io/name=gitea
              app.kubernetes.io/version=1.16.5
              controller-revision-hash=gitea-7b7874bd4c
              helm.sh/chart=gitea-0.0.0
              statefulset.kubernetes.io/pod-name=gitea-0
              version=1.16.5
Annotations:  checksum/config: eb870375ab8522187e77ef70bfb3f29a62a2d0ffcd8441bae4cc8a69301647da
              cni.projectcalico.org/podIP: 10.1.184.198/32
              cni.projectcalico.org/podIPs: 10.1.184.198/32
Status:       Pending
IP:           10.1.184.198
IPs:
  IP:           10.1.184.198
Controlled By:  StatefulSet/gitea
Init Containers:
  init-directories:
    Container ID:  containerd://2380a5989d393617f85ddf5b61d91ce3b198838f0862a33562dc377c1a59d334
    Image:         gitea/gitea:1.16.5
    Image ID:      docker.io/gitea/gitea@sha256:862ac2762dd67f8953678a4c3476ec373ac9f581d7dea8b78a30c51a305e5e80
    Port:          <none>
    Host Port:     <none>
    Command:
      /usr/sbin/init_directory_structure.sh
    State:          Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Wed, 20 Apr 2022 06:27:21 +0000
      Finished:     Wed, 20 Apr 2022 06:27:21 +0000
    Ready:          True
    Restart Count:  0
    Environment:
      GITEA_APP_INI:   /data/gitea/conf/app.ini
      GITEA_CUSTOM:    /data/gitea
      GITEA_WORK_DIR:  /data
      GITEA_TEMP:      /tmp/gitea
    Mounts:
      /data from data (rw)
      /tmp from temp (rw)
      /usr/sbin from init (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-vnk2h (ro)
  init-app-ini:
    Container ID:  containerd://72ae84bd2ce8d964cc21ff4b19d163f4f82ff3ca44b68cc7316776f291079729
    Image:         gitea/gitea:1.16.5
    Image ID:      docker.io/gitea/gitea@sha256:862ac2762dd67f8953678a4c3476ec373ac9f581d7dea8b78a30c51a305e5e80
    Port:          <none>
    Host Port:     <none>
    Command:
      /usr/sbin/config_environment.sh
    State:          Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Wed, 20 Apr 2022 06:27:22 +0000
      Finished:     Wed, 20 Apr 2022 06:27:22 +0000
    Ready:          True
    Restart Count:  0
    Environment:
      GITEA_APP_INI:   /data/gitea/conf/app.ini
      GITEA_CUSTOM:    /data/gitea
      GITEA_WORK_DIR:  /data
      GITEA_TEMP:      /tmp/gitea
    Mounts:
      /data from data (rw)
      /env-to-ini-mounts/inlines/ from inline-config-sources (rw)
      /tmp from temp (rw)
      /usr/sbin from config (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-vnk2h (ro)
  configure-gitea:
    Container ID:  containerd://a81fc2c439f5660ac7ea7d2658b8fcefd42d640467cdda2114be308e97e82295
    Image:         gitea/gitea:1.16.5
    Image ID:      docker.io/gitea/gitea@sha256:862ac2762dd67f8953678a4c3476ec373ac9f581d7dea8b78a30c51a305e5e80
    Port:          <none>
    Host Port:     <none>
    Command:
      /usr/sbin/configure_gitea.sh
    State:          Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Thu, 21 Apr 2022 07:37:38 +0000
      Finished:     Thu, 21 Apr 2022 07:37:44 +0000
    Last State:     Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Thu, 21 Apr 2022 07:32:25 +0000
      Finished:     Thu, 21 Apr 2022 07:32:31 +0000
    Ready:          False
    Restart Count:  295
    Environment:
      GITEA_APP_INI:         /data/gitea/conf/app.ini
      GITEA_CUSTOM:          /data/gitea
      GITEA_WORK_DIR:        /data
      GITEA_TEMP:            /tmp/gitea
      GITEA_ADMIN_USERNAME:  gitea_admin
      GITEA_ADMIN_PASSWORD:  r8sA8CPHD9!bt6d
    Mounts:
      /data from data (rw)
      /tmp from temp (rw)
      /usr/sbin from init (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-vnk2h (ro)
Containers:
  gitea:
    Container ID:
    Image:          gitea/gitea:1.16.5
    Image ID:
    Ports:          22/TCP, 3000/TCP
    Host Ports:     0/TCP, 0/TCP
    State:          Waiting
      Reason:       PodInitializing
    Ready:          False
    Restart Count:  0
    Liveness:       tcp-socket :http delay=200s timeout=1s period=10s #success=1 #failure=10
    Readiness:      tcp-socket :http delay=5s timeout=1s period=10s #success=1 #failure=3
    Environment:
      SSH_LISTEN_PORT:  22
      SSH_PORT:         22
      GITEA_APP_INI:    /data/gitea/conf/app.ini
      GITEA_CUSTOM:     /data/gitea
      GITEA_WORK_DIR:   /data
      GITEA_TEMP:       /tmp/gitea
      TMPDIR:           /tmp/gitea
    Mounts:
      /data from data (rw)
      /tmp from temp (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-vnk2h (ro)
Conditions:
  Type              Status
  Initialized       False
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  data:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  data-gitea-0
    ReadOnly:   false
  init:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  gitea-init
    Optional:    false
  config:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  gitea
    Optional:    false
  inline-config-sources:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  gitea-inline-config
    Optional:    false
  temp:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
  kube-api-access-vnk2h:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason   Age                   From     Message
  ----     ------   ----                  ----     -------
  Warning  BackOff  34s (x6833 over 25h)  kubelet  Back-off restarting failed container

Also checked the output of configure-gitea

 microk8s kubectl logs gitea-0 -c configure-gitea
==== BEGIN GITEA CONFIGURATION ====
2022/04/21 07:37:39 cmd/migrate.go:34:runMigrate() [I] AppPath: /usr/local/bin/gitea
2022/04/21 07:37:39 cmd/migrate.go:35:runMigrate() [I] AppWorkPath: /data
2022/04/21 07:37:39 cmd/migrate.go:36:runMigrate() [I] Custom path: /data/gitea
2022/04/21 07:37:39 cmd/migrate.go:37:runMigrate() [I] Log path: /data/log
2022/04/21 07:37:39 cmd/migrate.go:38:runMigrate() [I] Configuration file: /data/gitea/conf/app.ini
2022/04/21 07:37:39 ...e/[email protected]/app.go:277:Run() [I] PING DATABASE postgres
2022/04/21 07:37:44 cmd/migrate.go:41:runMigrate() [F] Failed to initialize ORM engine: dial tcp: lookup gitea-postgresql.default.svc.cluster.local: Try again
Gitea migrate might fail due to database connection...This init-container will try again in a few seconds

While going through this output, I found that there is some problem with the database and I checked the output of database pod logs

 microk8s kubectl logs gitea-postgresql-0
postgresql 06:27:15.77
postgresql 06:27:15.77 Welcome to the Bitnami postgresql container
postgresql 06:27:15.77 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
postgresql 06:27:15.77 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
postgresql 06:27:15.77
postgresql 06:27:15.80 INFO  ==> ** Starting PostgreSQL setup **
postgresql 06:27:15.82 INFO  ==> Validating settings in POSTGRESQL_* env vars..
postgresql 06:27:15.83 INFO  ==> Loading custom pre-init scripts...
postgresql 06:27:15.83 INFO  ==> Initializing PostgreSQL database...
postgresql 06:27:15.86 INFO  ==> pg_hba.conf file not detected. Generating it...
postgresql 06:27:15.86 INFO  ==> Generating local authentication configuration
postgresql 06:27:17.32 INFO  ==> Starting PostgreSQL in background...
postgresql 06:27:17.72 INFO  ==> Changing password of postgres
postgresql 06:27:17.73 INFO  ==> Creating user gitea
postgresql 06:27:17.75 INFO  ==> Granting access to "gitea" to the database "gitea"
postgresql 06:27:17.78 INFO  ==> Configuring replication parameters
postgresql 06:27:17.81 INFO  ==> Configuring fsync
postgresql 06:27:17.86 INFO  ==> Loading custom scripts...
postgresql 06:27:17.86 INFO  ==> Enabling remote connections
postgresql 06:27:17.88 INFO  ==> Stopping PostgreSQL...
waiting for server to shut down.... done
server stopped
postgresql 06:27:17.98 INFO  ==> ** PostgreSQL setup finished! **

postgresql 06:27:18.01 INFO  ==> ** Starting PostgreSQL **
2022-04-20 06:27:18.033 GMT [1] LOG:  pgaudit extension initialized
2022-04-20 06:27:18.034 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2022-04-20 06:27:18.034 GMT [1] LOG:  listening on IPv6 address "::", port 5432
2022-04-20 06:27:18.043 GMT [1] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2022-04-20 06:27:18.065 GMT [146] LOG:  database system was shut down at 2022-04-20 06:27:17 GMT
2022-04-20 06:27:18.073 GMT [1] LOG:  database system is ready to accept connections

But the database is ready for accepting connections and still the gitea pod is not running.

I also entered into the database pod to check whether I am able to acess the gitea database or not. I am able to access the gitea database.

$ psql -U gitea -d postgres
Password for user gitea:
psql (11.11)
Type "help" for help.

postgres=>

Can anyone please help me on this to get a solution for my issue.

0

There are 0 best solutions below