gpt4 book ai didi

kubernetes - 将 JHipster 项目部署到 Kubernetes 上时获取 "Error while creating file "/target""

转载 作者:行者123 更新时间:2023-12-02 11:39:04 27 4
gpt4 key购买 nike

我正在尝试将我的 Jhipster (v5.5.0) 项目部署到 Kubernetes (v1.16.3) 上,但 pod 一直失败并显示以下日志。谁有想法?

这是我的 YAML,它将创建部署/pod。我有另一个创建 PV 和 PVC 的 YAML。

kind: Deployment
metadata:
name: portal
spec:
replicas: 1
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
template:
spec:
containers:
- name: portal
image: "portal"
resources:
limits:
cpu: "0.5"
memory: "2048Mi"
requests:
cpu: "0.1"
memory: "64Mi"
imagePullPolicy: IfNotPresent
workingDir: /
securityContext:
runAsNonRoot: true
runAsUser: 950
ports:
- containerPort: 8080
imagePullSecrets:
- name: regcred
volumes:
- name: portal-db-vol01
persistentVolumeClaim:
claimName: portal-db-pvc-volume01
terminationGracePeriodSeconds: 15

以下是我的日志:

org.h2.jdbc.JdbcSQLException: Error while creating file "/target" [90062-196]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.get(DbException.java:155)
at org.h2.store.fs.FilePathDisk.createDirectory(FilePathDisk.java:274)
....

2020-02-05T21:59:14Z WARN 7 - [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.RuntimeException: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.netflix.zuul.ZuulConfiguration$ZuulFilterConfiguration': Unsatisfied dependency expressed through field 'filters'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'noCachePreFilter' defined in URL [jar:file:/app.war!/WEB-INF/classes!/com/odp/filters/pre/NoCachePreFilter.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'appRepository': Cannot create inner bean '(inner bean)#248deced' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#248deced': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [com/odp/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.DatabaseException: org.h2.jdbc.JdbcSQLException: Error while creating file "/target" [90062-196]

最佳答案

自容器portal在 pod 中以非 root 身份运行 950

          securityContext:
runAsNonRoot: true
runAsUser: 950

请确认此用户是否有权在 root / 中创建文件/文件夹.通常只有 root 有这个权限。非 root 用户唯一可写的文件夹位于:
Home directory (~/)
/tmp
/var/tmp

关于kubernetes - 将 JHipster 项目部署到 Kubernetes 上时获取 "Error while creating file "/target"",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60084910/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com