我有一个 Kubernetes 部署 yaml,它通过身份验证成功从私有 Docker 注册表中提取了镜像。
我想使用 Radius 执行相同的操作,但不清楚如何使用通用 Kubernetes(不是 Azure)执行此操作。
Kubernetes 在默认命名空间中配置了秘密“docker-registry-secret”,命名空间 Radius 使用“default-my-api”。
yaml使用imagePullSecrets;等效半径是多少?
K8s部署yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-api
spec:
selector:
matchLabels:
app: my-api
template:
metadata:
labels:
app: my-api
spec:
containers:
- name: my-api
image: reg.my-registry.com:5000/my-api-app:latest
imagePullSecrets:
- name: docker-registry-secret
二头肌半径:
import radius as radius
@description('The Radius Application ID. Injected automatically by the rad CLI.')
param application string
resource snapapi 'Applications.Core/containers@2023-10-01-preview' = {
name: 'my-api'
properties: {
application: application
container: {
image: 'reg.my-registry.com:5000/my-api-app:latest'
}
}
}
我看到错误“无法提取图像...没有基本身份验证凭据”
我可以找到使用 Azure 容器注册表的示例,但关于部署到本地通用 Kubernetes 集群的私有 Docker 映像注册表的示例并不多。
imagePullSecrets 似乎不是二头肌中受支持的机制。怎么配置的?
在二头肌文件中,使用以下内容:
properties: {
runtimes: {
kubernetes: {
base: loadTextContent('deployment.yaml')
}
}
}
这将使用基本 Kubernetes 资源清单,在其上应用 Radius 指定的属性。基础资源将包含 imagePullSecrets。有关更多信息,请参阅文档:Radius 文档 - 容器服务 -properties/runtimes/kubernetes