我正在尝试将 Nexus3 部署为 IBM Cloud 服务中的 Kubernetes pod。我收到此错误,可能是因为 PVC 安装为该用户的只读。例如,我在 Postgres 的其他时候也遇到过这个问题,但我不记得如何解决它:
mkdir: cannot create directory '../sonatype-work/nexus3/log': Permission denied
mkdir: cannot create directory '../sonatype-work/nexus3/tmp': Permission denied
Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file ../sonatype-work/nexus3/log/jvm.log due to No such file or directory
Warning: Cannot open log file: ../sonatype-work/nexus3/log/jvm.log
Warning: Forcing option -XX:LogFile=/tmp/jvm.log
Unable to update instance pid: Unable to create directory /nexus-data/instances
/nexus-data/log/karaf.log (No such file or directory)
Unable to update instance pid: Unable to create directory /nexus-data/instances
这些是 PVC 和 POD yaml:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nexus-pvc
annotations:
volume.beta.kubernetes.io/storage-class: "ibmc-file-retain-bronze"
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
apiVersion: v1
kind: Pod
metadata:
name: nexus
labels:
name: nexus
spec:
containers:
- name: nexus
image: sonatype/nexus3
ports:
- containerPort: 8081
volumeMounts:
- name: nexus-data
mountPath: /nexus-data
- name: tz-config
mountPath: /etc/localtime
volumes:
- name: nexus-data
persistentVolumeClaim:
claimName: nexus-pvc
- name: tz-config
hostPath:
path: /usr/share/zoneinfo/Europe/Madrid