将 Snipe-IT 资产管理从 Docker 迁移到 K8s

将 Snipe-IT 资产管理从 Docker 迁移到 K8s

我从一年前开始在 Docker 环境中运行 Snipe-it 应用程序(基于 Laravel 的资产管理软件),现在我想将其连同现有数据一起迁移到 K8s,为了移动数据库和 Snipe 应用程序的数据,我在 K8s 集群中创建了两个由 NFS 共享支持的持久卷。我已将数据从/var/lib/docker/volumes/snipe-vol/_data/var/lib/docker/volumes/db-vol/_datanfs 服务器:/nfs 共享/持久卷/snipe-volume/nfs 服务器:/nfs 共享/持久卷/db-volume/,snipe-vol 安装到/var/lib/snipeit/目录在应用程序容器内,数据库运行顺利,但是当我运行 Snipe 应用程序部署时,pod 崩溃并出现以下错误:

我之前在将 Wordpress 迁移到 K8s 时也遇到过同样的问题,我遇到了与数据库数据相同的权限错误,我通过将迁移数据的所有权更改为 NFS 服务器的 UID 999 来解决这个问题,并通过运行用户:999安全上下文到 DB yaml 文件,所以我尝试将 NFS 服务器共享上的 Snipe 应用程序数据的权限递归地更改为 www-data、docker、UID 1000 和 root,但都不起作用。

以下是 K8s 上 Snipe pod 的日志。

如果有人能帮助我将不胜感激。

chown: changing ownership of '/var/lib/snipeit/dumps': Operation not permitted
chown: changing ownership of '/var/lib/snipeit/keys/oauth-private.key': Operation not permitted
chown: changing ownership of '/var/lib/snipeit/keys/oauth-public.key': Operation not permitted
chown: changing ownership of '/var/lib/snipeit/keys': Operation not permitted
Changing upload limit to 100
Nothing to migrate.
Configuration cache cleared!
Configuration cache cleared!
Configuration cached successfully!
2023-06-26 11:08:57,877 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.
2023-06-26 11:08:57,878 INFO supervisord started with pid 1
2023-06-26 11:08:58,882 INFO spawned: 'exit_on_any_fatal' with pid 38
2023-06-26 11:08:58,884 INFO spawned: 'apache' with pid 39
2023-06-26 11:08:58,886 INFO spawned: 'run_schedule' with pid 40
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.0.171.77. Set the 'ServerName' directive globally to suppress this message
Action '-DFOREGROUND' failed.
The Apache error log may have more information.
2023-06-26 11:08:58,930 INFO exited: apache (exit status 1; not expected)
No scheduled commands are ready to run.
2023-06-26 11:09:00,140 INFO success: exit_on_any_fatal entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2023-06-26 11:09:00,143 INFO spawned: 'apache' with pid 51
2023-06-26 11:09:00,144 INFO success: run_schedule entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.0.171.77. Set the 'ServerName' directive globally to suppress this message
Action '-DFOREGROUND' failed.
The Apache error log may have more information.
2023-06-26 11:09:00,184 INFO exited: apache (exit status 1; not expected)
2023-06-26 11:09:02,188 INFO spawned: 'apache' with pid 54
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.0.171.77. Set the 'ServerName' directive globally to suppress this message
Action '-DFOREGROUND' failed.
The Apache error log may have more information.
2023-06-26 11:09:02,246 INFO exited: apache (exit status 1; not expected)
2023-06-26 11:09:05,252 INFO spawned: 'apache' with pid 57
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.0.171.77. Set the 'ServerName' directive globally to suppress this message
Action '-DFOREGROUND' failed.
The Apache error log may have more information.
2023-06-26 11:09:05,296 INFO exited: apache (exit status 1; not expected)
2023-06-26 11:09:05,297 INFO gave up: apache entered FATAL state, too many start retries too quickly
2023-06-26 11:09:06,298 WARN received SIGTERM indicating exit request
2023-06-26 11:09:06,298 INFO waiting for exit_on_any_fatal, run_schedule to die
2023-06-26 11:09:07,300 INFO stopped: run_schedule (terminated by SIGTERM)
2023-06-26 11:09:07,303 INFO stopped: exit_on_any_fatal (terminated by SIGTERM)
noor@master:~/snipe$

相关内容