我第一次尝试运行Helm。我正在使用deployment.yaml,service.yaml和ingress.yaml文件以及values.yaml和chart.yaml。
deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: abc
namespace: xyz
labels:
app: abc
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: 3
template:
spec:
containers:
- name: abc
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
ports:
-
containerPort: 8080
service.yaml
apiVersion: v1
kind: Service
metadata:
name: abc
labels:
app.kubernetes.io/managed-by: {{ .Release.Service }}
namespace: xyz
annotations:
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: {{ .Values.service.sslCert }}
spec:
ports:
- name: https
protocol: TCP
port: 443
targetPort: 8080
- name: http
protocol: TCP
port: 80
targetPort: 8080
type: ClusterIP
selector:
app: abc
ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: "haproxy-ingress"
namespace: xyz
labels:
app.kubernetes.io/managed-by: {{ .Release.Service }}
annotations:
kubernetes.io/ingress.class: alb
从我所看到的来看,我认为我并没有错过app.kubernetes.io/managed-by
的投放,但是仍然会出现错误:
rendered manifests contain a resource that already exists. Unable to continue with install: Service "abc" in namespace "xyz" exists and cannot be imported into the current release: invalid ownership metadata; label validation error: missing key "app.kubernetes.io/managed-by": must be set to "Helm"; annotation validation error: missing key "meta.helm.sh/release-name": must be set to "abc"; annotation validation error: missing key "meta.helm.sh/release-namespace": must be set to "default"
它可以在本地正确呈现文件。
helm list --all --all-namespaces
不返回任何内容。
请帮忙。
答案 0 :(得分:2)
您已经在给定的命名空间(名称空间abc
)中有一些要通过舵图安装的资源(服务xyz
)。
清理这些内容并通过helm install
安装它们。
$ kubectl delete service -n <namespace> <service-name>
$ kubectl delete deployment -n <namespace> <depoyment-name>
$ kubectl delete ingress -n <namespace> <ingress-name>
一旦掌舵者部署了这些资源,就可以执行helm update
来更改属性。
从您的Yaml中删除"app.kubernetes.io/managed-by"
此标签,该标签将由头盔添加。