我正在使用Vagrant和Vbox在我的Mac上部署一个Kubernetes。然后我安装了Istio,K本地服务,和Eventing。
然后,我定义了一个具有以下内容的service.yaml文件:
---
apiVersion: v1
kind: Namespace
metadata:
name: hello-k8s-ns
---
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: hello-k8s
namespace: hello-k8s-ns
spec:
template:
spec:
containers:
- image: sasadangelo/hello-k8s在那里sasadangelo/ Hello -K8是一个你好世界!我在docker中心构建并部署了Docker应用程序。我的问题是,当我尝试使用kubect apply命令部署它时,一切正常,但没有部署Pod。我看到了部署的服务,但是当我使用kubect describe分析它时,我会看到以下错误消息:
Revision "hello-k8s-lm6hk" failed with message: Unable to fetch image "sasadangelo/hello-k8s": failed to resolve image to digest: failed to fetch image information: Get https://index.docker.io/v2/: dial tcp 54.72.52.58:443: connect: connection refused.我不清楚为什么它不能从Docker中心下载图像。我的Vagrant正确地访问了Internet,并且命令:
kubectl run hello-k8s --generator=run-pod/v1 --image=sasadangelo/hello-k8s:latest --port=80效果很好。
因为我是刚接触过K本地的人,所以我怀疑我忽略了K本地配置中的一些东西。有人能帮忙吗?
发布于 2020-02-28 14:39:09
根据Mario的答复,我解决了配置Docker凭据的问题。这里是操作步骤。
我认为KNative出于某种原因不会简单地提取图像,但是它会做一些额外的事情(例如,验证摘要),请求Docker身份验证。
根据链接的过程,如果您发出命令:
kubectl create secret mysecret ...然后您需要以这样的方式修改service.yaml:
---
apiVersion: v1
kind: Namespace
metadata:
name: hello-k8s-ns
---
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: hello-k8s
namespace: hello-k8s-ns
spec:
template:
spec:
containers:
- image: sasadangelo/hello-k8s
imagePullSecrets: # <--------------- Add this line
- name: docker-hub-registry # <---- Add this linehttps://stackoverflow.com/questions/60416312
复制相似问题