我有一个Docker镜像gin-web,我在本地也可以推送到Docker Hub。当我在运行我的Kubernetes文件夹时,即Kubernetes/我的错误k8s-deployment.yml
Kubernetes由 控制台组成k8s-deployment.yml和k8s-service.yml服务。(使用minikube dashboard)。
我已经将已配置的Pod引用从私有注册表中提取图像并添加imagePullSecrets到k8-deployment.yml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: gin-web # Enter deployment name
labels:
app: gin-web
spec:
replicas: 3 #Enter the number of replicas
template:
metadata:
labels:
app: gin-web
tier: service
spec:
imagePullSecrets:
- name: regcred
containers:
- name: gin-web
image: "gin-web:1.0.1"
ports:
- containerPort: 9090
env:
- name: PORT
value: "9090"
# define resource requests and limits
resources:
requests:
memory: "64Mi"
cpu: "125m"
limits: #k8 automatically restart container when hit with these Limtis
memory: "128Mi"
cpu: "250m"
# check if gin-web is alive and healthy
#Check if MS recieve traffic from k*
readinessProbe:
httpGet:
path: /ping
port: 9090
initialDelaySeconds: 5
timeoutSeconds: 5
# check for k8 if container is healthy
livenessProbe:
httpGet:
path: /ping
port: 9090
initialDelaySeconds: 5
timeoutSeconds: 5
我在Kubernetes控制台中的Deployments下遇到此错误:
Failed to pull image "gin-web:1.0.1": rpc error: code = Unknown desc = Error response from daemon: pull access denied for gin-web, repository does not exist or may require 'docker login'
看起来您在容器图像字符串中缺少用户或组。据我所知,docker hub中的任何内容都不是简单的gin-web:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: gin-web # Enter deployment name
labels:
app: gin-web
spec:
replicas: 3 #Enter the number of replicas
template:
metadata:
labels:
app: gin-web
tier: service
spec:
imagePullSecrets:
- name: regcred
containers:
- name: gin-web
image: "<your-user>/gin-web:1.0.1" <== Add user here
ports:
- containerPort: 9090
env:
- name: PORT
value: "9090"
# define resource requests and limits
resources:
requests:
memory: "64Mi"
cpu: "125m"
limits: #k8 automatically restart container when hit with these Limtis
memory: "128Mi"
cpu: "250m"
# check if gin-web is alive and healthy
#Check if MS recieve traffic from k*
readinessProbe:
httpGet:
path: /ping
port: 9090
initialDelaySeconds: 5
timeoutSeconds: 5
# check for k8 if container is healthy
livenessProbe:
httpGet:
path: /ping
port: 9090
initialDelaySeconds: 5
timeoutSeconds: 5
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。