persistentvolumeclaim "media" 未找到
persistentvolumeclaim "media" not found
我正在尝试部署 Magento 应用程序,但出现以下错误。这个集群是在 EKS 上创建的,PVC 在那里
未找到持久卷声明“媒体”
错误:无法启动容器“magento-web”:来自守护程序的错误响应:OCI 运行时创建失败:container_linux.go:349: 启动容器进程导致“process_linux.go:449: 容器初始化导致“rootfs_linux.go:58: 将 \"/var/lib/kubelet/pods/8865b7dsdbd-721c-45f3-ab77-43a5f5da1362/volume-subpaths/nginx-config/magento-web/0\" 挂载到 rootfs \"=26=]\" at \"/var/lib/docker/overlay2/b1b3faa530b64ad6a9e62db641c5589fef3d29a9ab01fdsd2db594652851a1814a6/merged/etc/nginx/conf.d/default.conf\" 导致 \"not a directory \""": unknown: 您是否试图将目录挂载到文件上(或反之亦然)?检查指定的主机路径是否存在并且是预期的类型
退避重启失败的容器
apiVersion: v1
kind: Service
metadata:
name: magento-web
namespace: magento
labels:
app: magento-web
k8s-app: magento
spec:
ports:
- name: "http"
port: 80
protocol: TCP
targetPort: 80
selector:
app: magento-web
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: magento-web
namespace: magento
labels:
app: magento-web
k8s-app: magento
spec:
selector:
matchLabels:
app: magento-web
strategy:
rollingUpdate:
maxSurge: 50%
maxUnavailable: 30%
type: RollingUpdate
template:
metadata:
labels:
app: magento-web
k8s-app: magento
spec:
containers:
- image: nginx:mainline
imagePullPolicy: Always
name: magento-web
ports:
- containerPort: 80
protocol: TCP
resources:
limits:
cpu: 10m
memory: 128Mi
requests:
cpu: 10m
memory: 128Mi
volumeMounts:
- mountPath: /etc/nginx/conf.d/default.conf
name: nginx-config
subPath: default.conf
- mountPath: /var/www/html/magento2.conf
name: nginx-config
subPath: magento2.conf
- name: media
mountPath: /var/www/html/pub/media
- mountPath: /var/www/html/pub/static
name: static
volumes:
- configMap:
defaultMode: 420
name: nginx
name: nginx-config
- name: media
persistentVolumeClaim:
claimName: media
- name: static
persistentVolumeClaim:
claimName: static
kubectl get pvc -n magento
volumes:
- configMap:
defaultMode: 420
name: nginx
name: nginx-config
- name: media
persistentVolumeClaim:
claimName: media
- name: static
persistentVolumeClaim:
claimName: static
由于 default.conf 的错误状态为“您是否正在尝试将目录挂载到文件(或反之亦然)”,
configmap 用法似乎不正确,请尝试这样使用
- configMap:
items:
- key: default.conf
path: default.conf
name: nginx
name: nginx-config
我正在尝试部署 Magento 应用程序,但出现以下错误。这个集群是在 EKS 上创建的,PVC 在那里
未找到持久卷声明“媒体” 错误:无法启动容器“magento-web”:来自守护程序的错误响应:OCI 运行时创建失败:container_linux.go:349: 启动容器进程导致“process_linux.go:449: 容器初始化导致“rootfs_linux.go:58: 将 \"/var/lib/kubelet/pods/8865b7dsdbd-721c-45f3-ab77-43a5f5da1362/volume-subpaths/nginx-config/magento-web/0\" 挂载到 rootfs \"=26=]\" at \"/var/lib/docker/overlay2/b1b3faa530b64ad6a9e62db641c5589fef3d29a9ab01fdsd2db594652851a1814a6/merged/etc/nginx/conf.d/default.conf\" 导致 \"not a directory \""": unknown: 您是否试图将目录挂载到文件上(或反之亦然)?检查指定的主机路径是否存在并且是预期的类型 退避重启失败的容器
apiVersion: v1
kind: Service
metadata:
name: magento-web
namespace: magento
labels:
app: magento-web
k8s-app: magento
spec:
ports:
- name: "http"
port: 80
protocol: TCP
targetPort: 80
selector:
app: magento-web
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: magento-web
namespace: magento
labels:
app: magento-web
k8s-app: magento
spec:
selector:
matchLabels:
app: magento-web
strategy:
rollingUpdate:
maxSurge: 50%
maxUnavailable: 30%
type: RollingUpdate
template:
metadata:
labels:
app: magento-web
k8s-app: magento
spec:
containers:
- image: nginx:mainline
imagePullPolicy: Always
name: magento-web
ports:
- containerPort: 80
protocol: TCP
resources:
limits:
cpu: 10m
memory: 128Mi
requests:
cpu: 10m
memory: 128Mi
volumeMounts:
- mountPath: /etc/nginx/conf.d/default.conf
name: nginx-config
subPath: default.conf
- mountPath: /var/www/html/magento2.conf
name: nginx-config
subPath: magento2.conf
- name: media
mountPath: /var/www/html/pub/media
- mountPath: /var/www/html/pub/static
name: static
volumes:
- configMap:
defaultMode: 420
name: nginx
name: nginx-config
- name: media
persistentVolumeClaim:
claimName: media
- name: static
persistentVolumeClaim:
claimName: static
kubectl get pvc -n magento
volumes:
- configMap:
defaultMode: 420
name: nginx
name: nginx-config
- name: media
persistentVolumeClaim:
claimName: media
- name: static
persistentVolumeClaim:
claimName: static
由于 default.conf 的错误状态为“您是否正在尝试将目录挂载到文件(或反之亦然)”,
configmap 用法似乎不正确,请尝试这样使用
- configMap:
items:
- key: default.conf
path: default.conf
name: nginx
name: nginx-config