azure manage.py“:[错误2]没有此类文件或目录

fykwrbwg  于 2023-02-05  发布在  其他
关注(0)|答案(1)|浏览(153)

我正在通过GitHub操作在azure上部署微服务,pod状态为CrashLoopBackOff
以下是Kubernetes命名空间的logs命令输出,容器是crashbackoffloop
有没有什么要做的卷??根据一些搜索的人正在汇编有关这一点

kubectl logs --previous --tail 10  app-dev-559d688468-8lr6n  
 
/usr/local/bin/python: can't open file '/app/3/ON_ /Scripts/manage.py': [Errno 2] No such file or directory
apiVersion: apps/v1
kind: Deployment
metadata:
  name:  app-dev
  namespace: dev
spec:
  replicas: 1
  selector:
    matchLabels:
      app:  app
  template:
    metadata:
      labels:
        app: app
    spec:
      containers:
        - name:  -app
          image: "${DOCKER_REGISTRY}/app:${IMAGE_TAG}"
          readinessProbe:
            failureThreshold: 6
            httpGet:
              path: /
              port: 8000
            initialDelaySeconds: 30
            periodSeconds: 30
            successThreshold: 1
            timeoutSeconds: 1
          imagePullPolicy: Always

      

 
          command: ["/bin/sh"]
          args:
            - -c
            - >-
                /bin/sed -i -e "s/# 'autodynatrace.wrappers.django'/'autodynatrace.wrappers.django'/" /app/T /ON_ 3/ON_  /settings.py &&
                /usr/local/bin/python manage.py collectstatic --noinput &&
                AUTOWRAPT_BOOTSTRAP=autodynatrace AUTODYNATRACE_FORKABLE=True /usr/local/bin/gunicorn --workers 8 --preload --timeout 120 --config gunicorn.conf.py --bind 0.0.0.0:8000
          env:
            - name: AUTODYNATRACE_POD_NAME
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: metadata.name
            - name: AUTODYNATRACE_APPLICATION_ID
              value: Django ($(AUTODYNATRACE_POD_NAME):8000)
          ports:
            - containerPort: 8000
          volumeMounts:
           
          - name: secrets
            readOnly: true
            mountPath: /root/FHIREngine/conf
          - name: secrets
            readOnly: true
            mountPath: /home/ view/FHIREngine/conf
      imagePullSecrets:
         
        - name: docker-registry-credentials
      volumes:
       - name: secrets
         secret:
            secretName:   config
            defaultMode: 420
      restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
  name:  app
  namespace: dev
spec:
  type: NodePort
  ports:
    - name:  app
      port: 8000
      targetPort: 8000
  selector:
    app:  app
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: app
  namespace:  dev
  annotations:
    #external-dns.alpha.kubernetes.io/hostname:  .io
    #external-dns.alpha.kubernetes.io/type: external
    kubernetes.io/ingress.class: nginx-internal
spec:
  rules:
    - host:  com
      http:
        paths:
          - path: /
            backend:
              # serviceName: app
              # servicePort: 8000
              service:
                name:  app
                port:
                  number: 8000
            pathType: ImplementationSpecific

相同图像在AWS侧工作良好

kubectl describe pod

Events:
  Type     Reason   Age                    From     Message
  ----     ------   ----                   ----     -------
  Warning  BackOff  13m (x681 over 157m)   kubelet  Back-off restarting failed container
  Normal   Pulling  3m27s (x36 over 158m)  kubelet  Pulling image " applicationA:latest"

让我知道任何想法

sg3maiej

sg3maiej1#

Pod CrashLoopBackOff状态指示在Kubernetes中pod启动反复失败。

可能的解决方法I:

1)**OOMCiller:**您还可能在/app/3/ON_ /Scripts/manage.py输出的容器中看到Reason: OOM。检查应用程序是否需要更多资源。1)检查manage.py文件是否位于项目的根目录中。确保您需要位于manage.py所在的目录中。还要检查文件名是否有任何错误。
2)检查liveness probe failed,您可以在事件输出中看到类似‘manage.py': [Errno 2] No such file or directory的警告,因此请调整活动/就绪探测器的时间,有关详细信息,请参见定义就绪探测器。
请参考此链接了解更多详细信息。

可能的解决方法2:

基于warning :: reason: Backoff, message: Back-off restarting failed container
正如您提到的容器restartPolicy: Always,建议更改容器restartPolicy: OnFailure,一旦容器中的进程/命令结束,这应该会标记pod状态已完成。
有关详细信息,请参阅Kubernetes官方文档。

相关问题