【发布时间】:2022-01-22 09:43:06
【问题描述】:
我希望可以征求您的意见。
问题简而言之:我的管道无法将私有映像从 GHCR.IO 拉入 Okteto Kubernetes,但来自同一个私有存储库的公共映像工作。
我在 Windows 10 上使用 WSL2-Ubuntu 20.04 LTS 和 kinD 进行开发,也尝试了 minikube。
我在 Okteto 中收到一个错误,指出图像拉取是“未经授权的”->“imagePullBackOff”。
我做过的事情:浏览 Stack Overflow、RTFM、Okteto 常见问题解答、下载 Okteto kubeconfig、拔掉头发,花了比我想承认的更多的时间——仍然没有成功。
无论出于何种原因,我都无法创建一个有效的“kubectl secret”。当通过“docker login --username”登录到 ghcr.io 时,我可以在本地提取私有图像。
无论我尝试过什么,当我尝试在 Okteto 中提取私有图像时,仍然会收到“未授权”错误。
带有最新更新的我的设置:
- Windows 10 专业版
- JetBrains Rider IDE
- WSL2-Ubuntu 20.04 LTS
- ASP.NET Core MVC 应用程序
- .NET 6 SDK
- 码头工人
- 亲人
- minikube
- 巧克力
- 家酿
设置种类
kind create cluster --name my-name
kubectl create my-namespace
// create a secret to pull images from ghcr.io
kubectl create secret docker-registry my-secret -n my-namespace --docker-username="my-username" --docker-password="my-password" --docker-email="my-email" --docker-server="https://ghcr.io"
// patch local service account
kubectl patch serviceaccount default -p '{"imagePullSecrets": [{"name": "my-secret"}]}'
kubernetes.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: okteto-repo
namespace: my-namespace
spec:
replicas: 1
selector:
matchLabels:
app: okteto-repo
template:
metadata:
labels:
app: okteto-repo
spec:
containers:
- name: okteto-repo
image: ghcr.io/user/okteto-repo:latest
ports:
- containerPort: 80
imagePullSecrets:
- name: my-secret
---
apiVersion: v1
kind: Service
metadata:
name: okteto-repo
annotations:
dev.okteto.com/auto-ingress: "true"
spec:
type: ClusterIP
selector:
app: okteto-repo
ports:
- protocol: TCP
port: 8080
targetPort: 80
你知道为什么它不起作用以及我能做什么吗?
非常感谢我亲爱的朋友们,非常感谢每一个输入!
希望你们假期愉快。
干杯, 迈克尔
【问题讨论】:
标签: docker kubernetes minikube ghcr okteto