我正在使用minikube
和kubectl
创建一个mongo
的RC
。同时,我正在使用公司的VPN。
通过kubectl create -f ./rc/mongo-rc.yaml
命令创建了RC
。
当使用kubectl describe pod mongo-5zttk
命令时,获得了下面的kubernetes事件:
...
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 7m18s default-scheduler Successfully assigned default/mongo-5zttk to minikube
Normal Pulling 5m42s (x4 over 7m17s) kubelet, minikube Pulling image "mongo"
Warning Failed 5m40s (x4 over 7m15s) kubelet, minikube Failed to pull image "mongo": rpc error: code = Unknown desc = Error response from daemon: Get https://registry-1.docker.io/v2/library/mongo/manifests/latest: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fmongo%3Apull&service=registry.docker.io: x509: certificate signed by unknown authority
Warning Failed 5m40s (x4 over 7m15s) kubelet, minikube Error: ErrImagePull
Normal BackOff 5m29s (x6 over 7m15s) kubelet, minikube Back-off pulling image "mongo"
Warning Failed 2m8s (x21 over 7m15s) kubelet, minikube Error: ImagePullBackOff
使用curl访问URL时:
⚡ curl https://registry-1.docker.io/v2/library/mongo/manifests/latest
{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"repository","Class":"","Name":"library/mongo","Action":"pull"}]}]}
我能够成功从Docker Hub注册表中拉取
mongo:latest
镜像。⚡ docker pull mongo:latest
latest: Pulling from library/mongo
Digest: sha256:efc408845bc917d0b7fd97a8590e9c8d3c314f58cee651bd3030c9cf2ce9032d
Status: Image is up to date for mongo:latest
docker.io/library/mongo:latest
环境信息:
- minikube 版本: v1.14.1
- kubectl
- 客户端版本:v1.18.8
- 服务器版本:v1.19.2
- 操作系统:macOS 10.13.6
我已阅读文档:vpn_and_proxy/#x509-certificate-signed-by-unknown-authority。解决方案是向 IT 部门请求适当的 PEM 文件。如果我无法获得 PEM 文件,是否有其他解决方案?例如使用一些命令标志:--skip-verify-cert
?
更新:
mongo-rc.yaml
:
apiVersion: v1
kind: ReplicationController
metadata:
name: mongo
spec:
replicas: 1
selector:
app: mongo
template:
metadata:
labels:
app: mongo
spec:
containers:
- name: mongo
image: mongo
ports:
- containerPort: 27017
env:
- name: MONGO_ROOT_PASSWORD
value: "123456"