我希望征求你的意见是可以的。
简单地说,问题是:我的管道不能将GHCR.IO中的私有图像拖到中,但是来自同一私人回购工作的公共图像。
我是在Windows 10和使用WSL2-Ubuntu20.04LTS与kinD进行开发,并尝试了微型库。
我在Okteto中看到一个错误,它说图像拉扯是“未经授权的”->“imagePullBackOff”。
我所做的事情:浏览堆栈溢出,RTFM,Okteto FAQ,下载Okteto kubeconfig,拔出我的头发,花了比我想承认的更多的时间--至今还没有成功。
无论出于什么原因,我都不能创造一个有效的“kubectl秘密”。当通过“停靠者登录--用户名”登录到ghcr.io时,我可以在本地提取私有图像。
无论我尝试了什么,当我试图在Okteto中提取一个私人图像时,我仍然会遇到“未经授权”的错误。
我的安装程序有最新更新:
设置kinD
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你知道为什么不起作用吗?我能做些什么?
非常感谢我亲爱的朋友们,每一次的投入都是非常感谢的!
希望你们假期愉快。
干杯,迈克尔
发布于 2021-12-21 00:32:23
通过以下操作,我能够画出一张私人图片:
repo访问创建个人令牌。okteto build -t ghcr.io/rberrelleza/go-getting-started:0.0.1)okteto context update-kubeconfig。kubectl create secret docker-registry gh-regcred --docker-server=ghcr.io --docker-username=rberrelleza --docker-password=ghp_XXXXXXkubectl patch serviceaccount default -p '{"imagePullSecrets": [{"name": "gh-regcred"}]}'kubectl apply -f k8s.yaml)这就是我的kubernetes资源的样子,以防有帮助:
# k8s.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-world
spec:
replicas: 1
selector:
matchLabels:
app: hello-world
template:
metadata:
labels:
app: hello-world
spec:
containers:
- image: ghcr.io/rberrelleza/go-getting-started:0.0.1
name: hello-world
---
apiVersion: v1
kind: Service
metadata:
name: hello-world
annotations:
dev.okteto.com/auto-ingress: "true"
spec:
type: ClusterIP
ports:
- name: "hello-world"
port: 8080
selector:
app: hello-world# default SA
apiVersion: v1
imagePullSecrets:
- name: gh-regcred
- name: okteto-regcred
kind: ServiceAccount
metadata:
creationTimestamp: "2021-05-21T22:26:38Z"
name: default
namespace: rberrelleza
resourceVersion: "405042662"
uid: 2b6a6eef-2ce7-40d3-841a-c0a5497279f7
secrets:
- name: default-token-7tm42https://stackoverflow.com/questions/70427486
复制相似问题