当前位置: 首页 > 知识库问答 >
问题:

部署应用程序时出错:persistentvolumeclaims已存在

高运诚
2023-03-14
version: '3'

services:
  katana-db:
    image: postgres
    restart: always
    environment:
      POSTGRES_PASSWORD: *****
      POSTGRES_USER: *****
  backend:
    depends_on:
      - katana-db
    build:
      context: .
      dockerfile: dockerfile_uwsgi
    image: warrior_deployment_backend
    extra_hosts:
      - "example.com:100.0.0.201"
    volumes:
      - katana-secrets:/secrets
      - katana-static:/warriorframework_py3/static
      - katana-wapps:/warriorframework_py3/katana/wapps
      - katana-wui:/warriorframework_py3/katana/wui
    ports:
      - "4000:4000"
    environment:
      DB_HOST: katana-db
      DB_NAME: warrior
      DB_USER: *****
      DB_PASSWORD: *****
  migration:
    depends_on:
      - backend
    image: warrior_deployment_backend
    entrypoint: ["sh", "-c"]
    command: ["
      python /warriorframework_py3/katana/manage.py collectstatic --noinput;
      python /warriorframework_py3/katana/manage.py makemigrations;
      python /warriorframework_py3/katana/manage.py migrate;
      echo \"from django.contrib.auth import get_user_model; User = get_user_model(); x = User.objects.create_superuser('admin', '', 'warriorframework') if not User.objects.filter(username='admin').exists() else User.objects.get(username='admin'); x.set_password('warriorframework'); x.save()\" | python /warriorframework_py3/katana/manage.py shell;
      "]
    volumes:
      - katana-static:/warriorframework_py3/static
      - katana-wapps:/warriorframework_py3/katana/wapps
      - katana-wui:/warriorframework_py3/katana/wui
    environment:
      DB_HOST: katana-db
      DB_NAME: warrior
      DB_USER: warrior
      DB_PASSWORD: qwerty
  frontend:
    depends_on:
      - backend
    build:
      context: .
      dockerfile: dockerfile_nginx
    image: warrior_deployment_frontend
    volumes:
      - katana-static:/warriorframework_py3/static
      - nginx-secrets:/secrets
    ports:
      - "9443:8443"
    labels:
      kompose.service.expose: "true"

volumes:
  katana-static:
    driver: local-persist
    driver_opts:
      mountpoint: /data/local-persist/data/warrior/katana-static
  katana-wapps:
    driver: local-persist
    driver_opts:
      mountpoint: /data/local-persist/data/warrior/wapps
  katana-wui:
    driver: local-persist
    driver_opts:
      mountpoint: /data/local-persist/data/warrior/wui
  nginx-secrets:
    driver: local-persist
    driver_opts:
      mountpoint: /data/local-persist/data/warrior/nginx-secrets
  katana-secrets:
    driver: local-persist
    driver_opts:
      mountpoint: /data/local-persist/data/warrior/katana-secrets

错误如下:

部署应用程序时出现FATA错误:persistentvolumeclaims“Katana-Static”已存在

完整的控制台日志如下:

INFO Building image 'warrior_deployment_backend' from directory 'warrior_docker_deployment'
INFO Image 'warrior_deployment_backend' from directory 'warrior_docker_deployment' built successfully
INFO Pushing image 'warrior_deployment_backend:latest'
INFO Multiple authentication credentials detected. Will try each configuration.
INFO Attempting authentication credentials 'docker-registry-default.router.default.svc.cluster.local
INFO Successfully pushed image 'warrior_deployment_backend:latest'
INFO Building image 'warrior_deployment_frontend' from directory 'warrior_docker_deployment'
INFO Image 'warrior_deployment_frontend' from directory 'warrior_docker_deployment' built successfully
INFO Pushing image 'warrior_deployment_frontend:latest' to registry 
INFO Multiple authentication credentials detected. Will try each configuration.
INFO Attempting authentication credentials 'docker-registry-default.router.default.svc.cluster.local
INFO Successfully pushed image 'warrior_deployment_frontend:latest' 
INFO We are going to create OpenShift DeploymentConfigs, Services and PersistentVolumeClaims for your Dockerized application.
If you need different kind of resources, use the 'kompose convert' and 'oc create -f' commands instead.

INFO Deploying application in "rak-warrior-ui" namespace
INFO Successfully created Service: backend
INFO Successfully created Service: frontend
INFO Successfully created DeploymentConfig: backend
INFO Successfully created ImageStream: backend
INFO Successfully created PersistentVolumeClaim: katana-secrets of size 100Mi. If your cluster has dynamic storage provisioning, you don't have to do anything. Otherwise you have to create PersistentVolume to make PVC work
INFO Successfully created PersistentVolumeClaim: katana-static of size 100Mi. If your cluster has dynamic storage provisioning, you don't have to do anything. Otherwise you have to create PersistentVolume to make PVC work
INFO Successfully created PersistentVolumeClaim: katana-wapps of size 100Mi. If your cluster has dynamic storage provisioning, you don't have to do anything. Otherwise you have to create PersistentVolume to make PVC work
INFO Successfully created PersistentVolumeClaim: katana-wui of size 100Mi. If your cluster has dynamic storage provisioning, you don't have to do anything. Otherwise you have to create PersistentVolume to make PVC work
INFO Successfully created DeploymentConfig: frontend
INFO Successfully created ImageStream: frontend
INFO Successfully created Route: frontend
FATA Error while deploying application: persistentvolumeclaims "katana-static" already exists

    null

如果有任何其他论坛我可以问这个问题,请分享评论部分的链接。提前谢谢。

共有1个答案

柯骏
2023-03-14

问题可能是本地卷

volumes:
  katana-static:
    driver: local-persist
    driver_opts:
      mountpoint: /data/local-persist/data/warrior/katana-static
  katana-wapps:
    driver: local-persist
    driver_opts:
      mountpoint: /data/local-persist/data/warrior/wapps
  katana-wui:
    driver: local-persist
    driver_opts:
      mountpoint: /data/local-persist/data/warrior/wui
  nginx-secrets:
    driver: local-persist
    driver_opts:
      mountpoint: /data/local-persist/data/warrior/nginx-secrets
  katana-secrets:
    driver: local-persist
    driver_opts:
      mountpoint: /data/local-persist/data/warrior/katana-secrets

本地卷在OpenShift中不工作。我建议您使用'kompose convert'命令将docker-compose转换为kubernetes YAMLs。

然后回顾和更新pvc和PV的。然后最后一个一个地部署资源

 类似资料:
  • 我有一个Grails(2.5.3版)应用程序,当我通过选项:要部署的WAR文件在Tomcat中部署时,选择WAR文件,会出现以下错误。如果我尝试一个更简单的应用程序(大小、复杂度等),它运行得很好。 但是,如果在从manager运行应用程序时手动将war文件的内容复制到Tomcat路径:pathTomcat/webapps/myApplication,则效果良好。出现任何错误。 错误: Grail

  • 当我在glassfish 4.1中部署war文件时,会出现以下异常

  • 错误:命令错误,退出状态为1:Command://app/.heroku/python/bin/python/app/.heroku/python/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel/tmp/tmp3b4z4ntu cwd://tmp/pip-i

  • 部署过程中出错:部署应用程序[EnterpriseApplication1]时出现异常:UnsupportedClassVersionError:类mn.interactive.module.meta.dao.MetadataDao的主要或次要版本号不受支持,这些版本号大于Java Runtime Environment版本1.7.0_02中的版本号。有关详细信息,请参阅server.log。 将

  • 我曾经在Glassfish服务器上毫不费力地部署了JSF Primefaces应用程序。最近我升级了我的NetBeans版本。在那之后,我的大部分申请都没有出现任何问题。但是当我尝试使用其中一个进行部署时,它失败了,错误消息如下: 部署期间发生错误:加载应用程序时出现异常:java.lang.IllegalStateException:ContainerBase.addChild:start:or

  • 我正在尝试在weblogic application server 10.3中部署一个web应用程序 部署后,当我尝试激活更改时,我收到以下异常 我知道包含以下类org/apache/Commons/digester/Digester的jar文件在服务器运行时中丢失。 我在$DOMAIN/lib中添加了这个jar,并重新启动了weblogic服务器。部署后,我收到了相同的错误。 请告知。