我正在尝试实现Kubernetes资源部署。为此,我创建了它deployment.yaml
并service.yaml
作为我的 Kubernetes 资源。latest
并在我的最新标签中引用 dockerhub 注册表映像deployment.yaml. When I am doing like this, latest image is not pulling with
。
所以我在部署中添加了时间戳,如下所示:
template:
metadata:
labels:
app: test-kube-deployment
date: date "+%H:%M:%S %d/%m/%y"
spec:
imagePullSecrets:
- name: "regcred"
containers:
- name: test-kube-deployment-container
image: spacestudymilletech010/spacestudykubernetes:latest
imagePullPolicy: Always
ports:
- name: http
containerPort: 8085
protocol: TCP
Run Code Online (Sandbox Code Playgroud)
当我在这里添加时间时,我收到如下错误,
The Deployment "test-kube-deployment" is invalid: spec.template.labels: Invalid value: "date \"+%H:%M:%S %d/%m/%y\"": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character
Run Code Online (Sandbox Code Playgroud)
我需要进行哪些修改来定义时间戳以唯一标识我的 Docker 映像?
不要将其添加为标签,而是添加为注释。
template:
metadata:
labels:
app: test-kube-deployment
annotations:
date: "+%H:%M:%S %d/%m/%y"
Run Code Online (Sandbox Code Playgroud)
PD.- 您收到错误是因为标签不接受 +、% 和 : 字符。
归档时间: |
|
查看次数: |
3488 次 |
最近记录: |