dromara / domain-admin

域名SSL证书监测平台、SSL证书申请自动续签。Domain and SSL Cert monitor System.
https://domain-admin.cn/
MIT License
1.85k stars 265 forks source link

使用 k8s 部署失败 #97

Closed liuweiGL closed 7 months ago

liuweiGL commented 7 months ago

感谢作者提供这么好用的产品,我在 k8s 中部署时遇到一点问题麻烦帮忙看下是 docker image 的问题吗?

k8s deployment 定义

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    field.cattle.io/description: https://github.com/mouday/domain-admin
  generation: 5
  labels:
    workload.user.cattle.io/workloadselector: apps.deployment-domain-admin-domain-admin
  name: domain-admin
  namespace: domain-admin
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      workload.user.cattle.io/workloadselector: apps.deployment-domain-admin-domain-admin
  template:
    metadata:
      labels:
        workload.user.cattle.io/workloadselector: apps.deployment-domain-admin-domain-admin
      name: domain-admin
      namespace: domain-admin
    spec:
      containers:
        - image: mouday/domain-admin:v1.6.23
          imagePullPolicy: IfNotPresent
          livenessProbe:
            failureThreshold: 3
            periodSeconds: 10
            successThreshold: 1
            tcpSocket:
              port: 8000
            timeoutSeconds: 1
          name: container-0
          ports:
            - containerPort: 8000
              name: domain-admin
              protocol: TCP
          startupProbe:
            failureThreshold: 3
            periodSeconds: 10
            successThreshold: 1
            tcpSocket:
              port: 8000
            timeoutSeconds: 1
          volumeMounts:
            - mountPath: /app
              name: pv-domain-admin
      volumes:
        - name: pv-domain-admin
          persistentVolumeClaim:
            claimName: data-domain-admin

日志

[2024-04-08 00:46:51 +0800] [1] [INFO] Starting gunicorn 21.2.0
2024-04-08T00:46:51.224490118+08:00 [2024-04-08 00:46:51 +0800] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
2024-04-08T00:46:51.224523160+08:00 [2024-04-08 00:46:51 +0800] [1] [INFO] Using worker: sync
2024-04-08T00:46:51.226009895+08:00 [2024-04-08 00:46:51 +0800] [8] [INFO] Booting worker with pid: 8
2024-04-08T00:46:51.227981538+08:00 [2024-04-08 00:46:51 +0800] [8] [ERROR] Exception in worker process
2024-04-08T00:46:51.227987411+08:00 Traceback (most recent call last):
2024-04-08T00:46:51.227990101+08:00   File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker
2024-04-08T00:46:51.227995036+08:00     worker.init_process()
2024-04-08T00:46:51.227996843+08:00   File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 134, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2024-04-08T00:46:51.228003555+08:00     self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2024-04-08T00:46:51.228006455+08:00     self.callable = self.load()
2024-04-08T00:46:51.228008001+08:00   File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2024-04-08T00:46:51.228009431+08:00     return self.load_wsgiapp()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2024-04-08T00:46:51.228012406+08:00     return util.import_app(self.app_uri)
2024-04-08T00:46:51.228013986+08:00   File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 371, in import_app
2024-04-08T00:46:51.228015560+08:00     mod = importlib.import_module(module)
2024-04-08T00:46:51.228017008+08:00   File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
2024-04-08T00:46:51.228018515+08:00     return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
2024-04-08T00:46:51.228021225+08:00   File "<frozen importlib._bootstrap>", line 983, in _find_and_load
2024-04-08T00:46:51.228022774+08:00   File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
2024-04-08T00:46:51.228024186+08:00   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
2024-04-08T00:46:51.228027090+08:00   File "<frozen importlib._bootstrap>", line 983, in _find_and_load
2024-04-08T00:46:51.228029056+08:00   File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
2024-04-08T00:46:51.228031227+08:00 ModuleNotFoundError: No module named 'domain_admin'
2024-04-08T00:46:51.228037208+08:00 [2024-04-08 00:46:51 +0800] [8] [INFO] Worker exiting (pid: 8)
2024-04-08T00:46:51.240300353+08:00 [2024-04-08 00:46:51 +0800] [1] [ERROR] Worker (pid:8) exited with code 3
[2024-04-08 00:46:51 +0800] [1] [ERROR] Shutting down: Master
2024-04-08T00:46:51.240502352+08:00 [2024-04-08 00:46:51 +0800] [1] [ERROR] Reason: Worker failed to boot.
mouday commented 7 months ago

解决了吗?什么原因

mouday commented 7 months ago

解决了吗?

liuweiGL commented 7 months ago

pv 挂载点设置成 /app 把项目代码覆盖了

mouday commented 7 months ago

好吧,k8s不是很懂,群里倒是有用k8s的伙伴