I am trying to deploy to the Azure Kubernetes cluster using Helm charts. While trying to execute following command:
helm install --namespace custom-namspace my-project ./my-project
I am getting following error:
Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: [ValidationError(Deployment.spec.template.spec.volumes[1]): unknown field "namespace" in io.k8s.api.core.v1.Volume, ValidationError(Deployment.spec.template.spec.volumes[1]): missing required field "name" in io.k8s.api.core.v1.Volume]
Following is my deployment.yaml file:
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.serviceName }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ .Values.serviceName }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ .Values.serviceName }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
serviceAccountName: {{ .Values.serviceAccountName }}
automountServiceAccountToken: true
imagePullSecrets:
containers:
- image: "{{ .Values.dockerimage }}"
name: {{ .Values.serviceName }}
env:
- name: {{ $key }}
value: {{ $value | quote }}
- name: {{ $key }}
value: {{ $value | quote }}
- name: {{ $key }}
value: {{ $value | quote }}
- name: {{ $key }}
value: {{ $value | quote }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: HTTP
containerPort: {{ .Values.appPort }}
protocol: TCP
resources:
requests:
memory: {{ .Values.appRessource.request.memory }}
cpu: {{ .Values.appRessource.request.cpu }}
limits:
memory: {{ .Values.appRessource.limit.memory }}
cpu: {{ .Values.appRessource.limit.cpu }}
volumes:
- name: secretfiles
secret:
secretName: secret-vault
optional: true
items:
- key: some-key
path: custom/some.key
- name: custommappings-volume
configMap:
name: custommappings
optional: true
- name: customxsds-volume
configMap:
name: customxsds
optional: true
mountPoints:
- name: secretfiles
mountPath: "/some-path/secretfiles"
readOnly: true
- name: custommappings-volume
mountPath: /app/some-path/client
readOnly: true
- name: customxsds-volume
mountPath: /app/some-path/xsd/client
readOnly: true
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
I have also referred to this Github issue but it didn't serve the purpose.
This is the first time I am working on Kubernetes deployment and Helm chart. I would really grateful for any help.