我有一个使用 Docker 成功运行的 Remix 应用程序。然后,我想使用 OpenShift 和 HelmChart 在 OpenShift 中部署应用程序。但是,我收到错误 ImagePullBackOff 并且无法拉取图像:
oc describe pod remixapp-web-869c55d88c-djb7p
Name: remixapp-web-869c55d88c-djb7p
Namespace: johndoe-dev
Priority: -3
Priority Class Name: sandbox-users-pods
Service Account: default
Node: ip-10-0-203-61.ec2.internal/10.0.203.61
Start Time: Thu, 07 Mar 2024 14:58:23 -0800
Labels: app=remixapp-web
pod-template-hash=869c55d88c
Annotations: k8s.ovn.org/pod-networks:
{"default":{"ip_addresses":["10.128.42.100/23"],"mac_address":"0a:58:0a:80:2a:64","gateway_ips":["10.128.42.1"],"routes":[{"dest":"10.128....
k8s.v1.cni.cncf.io/network-status:
[{
"name": "ovn-kubernetes",
"interface": "eth0",
"ips": [
"10.128.42.100"
],
"mac": "0a:58:0a:80:2a:64",
"default": true,
"dns": {}
}]
openshift.io/scc: restricted-v2
seccomp.security.alpha.kubernetes.io/pod: runtime/default
Status: Pending
SeccompProfile: RuntimeDefault
IP: 10.128.42.100
IPs:
IP: 10.128.42.100
Controlled By: ReplicaSet/remixapp-web-869c55d88c
Containers:
remixapp-web:
Container ID:
Image: image-registry.openshift-image-registry.svc:5000/johndoe-dev/remixapp-web:develop
Image ID:
Port: <none>
Host Port: <none>
State: Waiting
Reason: ImagePullBackOff
Ready: False
Restart Count: 0
Limits:
cpu: 250m
memory: 512Mi
Requests:
cpu: 150m
memory: 512Mi
Environment Variables from:
remixapp-web-config Secret Optional: false
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-wj8gl (ro)
Conditions:
Type Status
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
kube-api-access-wj8gl:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional: <nil>
DownwardAPI: true
ConfigMapName: openshift-service-ca.crt
ConfigMapOptional: <nil>
QoS Class: Burstable
Node-Selectors: <none>
Tolerations: node.kubernetes.io/memory-pressure:NoSchedule op=Exists
node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 74s default-scheduler Successfully assigned johndoe-dev/remixapp-web-869c55d88c-djb7p to ip-10-0-203-61.ec2.internal
Normal AddedInterface 74s multus Add eth0 [10.128.42.100/23] from ovn-kubernetes
Normal Pulling 31s (x3 over 74s) kubelet Pulling image "image-registry.openshift-image-registry.svc:5000/johndoe-dev/remixapp-web:develop"
Warning Failed 31s (x3 over 74s) kubelet Failed to pull image "image-registry.openshift-image-registry.svc:5000/johndoe-dev/remixapp-web:develop": rpc error: code = Unknown desc = reading manifest develop in image-registry.openshift-image-registry.svc:5000/johndoe-dev/remixapp-web: name unknown
Warning Failed 31s (x3 over 74s) kubelet Error: ErrImagePull
Normal BackOff 3s (x5 over 74s) kubelet Back-off pulling image "image-registry.openshift-image-registry.svc:5000/johndoe-dev/remixapp-web:develop"
Warning Failed 3s (x5 over 74s) kubelet Error: ImagePullBackOff
我创建了一个新图表
helm create remixapp
并使用以下内容修改了文件 value.yaml 和 deployment.yaml:
values.yaml
app_name: remixapp
replicas: 1
image_stream_tag: develop
namespace_env: arturoreyeslopez-dev
limits_cpu: 250m
limits_memory: 512Mi
requests_cpu: 150m
requests_memory: 512Mi
cluster: silver
dockerhost: image-registry.openshift-image-registry.svc:5000
service:
type: ClusterIP
port: 80
模板/deployment.yaml:
---
kind: Deployment
apiVersion: apps/v1
metadata:
annotations:
deployment.kubernetes.io/revision: '8'
image.openshift.io/triggers: |-
[
{
"from": {
"kind": "ImageStreamTag",
"namespace": "{{ .Values.namespace_env }}",
"name": "{{ .Values.app_name }}-web:{{ .Values.image_stream_tag }}"
},
"fieldPath": "spec.template.spec.containers[0].image"
}
]
name: {{ .Values.app_name }}-web
namespace: {{ .Values.namespace_env }}
labels:
app: {{ .Values.app_name }}-web
spec:
replicas: {{ .Values.replicas }}
selector:
matchLabels:
app: {{ .Values.app_name }}-web
template:
metadata:
labels:
app: {{ .Values.app_name }}-web
spec:
containers:
- name: {{ .Values.app_name }}-web
image: {{ .Values.dockerhost }}/{{ .Values.namespace_env }}/{{ .Values.app_name }}-web:{{ .Values.image_stream_tag }}
resources:
limits:
cpu: {{ .Values.limits_cpu }}
memory: {{ .Values.limits_memory }}
requests:
cpu: {{ .Values.requests_cpu}}
memory: {{ .Values.requests_memory }}
terminationMessagePath: /dev/termination-log
envFrom:
- secretRef:
name: {{ .Values.app_name }}-web-config
imagePullPolicy: IfNotPresent
terminationMessagePolicy: File
#volumeMounts:
# - name: {{ .Values.app_name }}-nginx-cache
# mountPath: /var/cache/nginx
restartPolicy: Always
serviceAccount: default
#volumes:
# - name: {{ .Values.app_name }}-nginx-cache
# emptyDir: {}
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
revisionHistoryLimit: 5
progressDeadlineSeconds: 600
模板/services.yaml:
kind: Service
apiVersion: v1
metadata:
name: {{ .Values.app_name }}-web
labels:
app: {{ .Values.app_name }}-web
name: {{ .Values.app_name }}-web
spec:
ports:
- name: 8080-tcp
port: 80
protocol: TCP
targetPort: 8080
selector:
app: {{ .Values.app_name }}-web
sessionAffinity: None
type: ClusterIP
你知道为什么图片拉不出来吗?或者我可以检查是否有任何线索可以根据我当前的配置找出为什么会发生此错误?
非常感谢您的帮助:)
发布您如何发布图像的详细信息。
关键是
Failed to pull image "image-registry.openshift-image-registry.svc:5000/johndoe-dev/remixapp-web:develop": rpc error: code = Unknown desc = reading manifest develop in image-registry.openshift-image-registry.svc:5000/johndoe-dev/remixapp-web: name unknown
图像可能没有开发标签。