Kubernetes 错误:Deployment.apps“;齿轮箱袋鼠建筑艺术“;无效:

Kubernetes 错误:Deployment.apps“;齿轮箱袋鼠建筑艺术“;无效:,kubernetes,kubernetes-helm,kubernetes-pod,helmfile,Kubernetes,Kubernetes Helm,Kubernetes Pod,Helmfile,舵手安装有齿轮的袋鼠。/buildachart/ 错误:Deployment.apps“geared marsupi buildachart”无效:spec.template.spec.containers[1]。volumeMounts[0]。名称:未找到:“postgres\u sql” 它看起来更像是一个缩进问题,但不知何故它不起作用并且失败了。 我有两个容器,一个是drupal,它不需要任何卷,第二个是postgresql,我添加了卷 apiVersion: apps/v1 kin

舵手安装有齿轮的袋鼠。/buildachart/ 错误:Deployment.apps“geared marsupi buildachart”无效:spec.template.spec.containers[1]。volumeMounts[0]。名称:未找到:“postgres\u sql”

它看起来更像是一个缩进问题,但不知何故它不起作用并且失败了。 我有两个容器,一个是drupal,它不需要任何卷,第二个是postgresql,我添加了卷




apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "buildachart.fullname" . }}
  labels:
    {{- include "buildachart.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
  replicas: {{ .Values.replicaCount }}
{{- end }}
  selector:
    matchLabels:
      {{- include "buildachart.selectorLabels" . | nindent 6 }}
  template:
    metadata:
    {{- with .Values.podAnnotations }}
      annotations:
        {{- toYaml . | nindent 8 }}
    {{- end }}
      labels:
        {{- include "buildachart.selectorLabels" . | nindent 8 }}
    spec:
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      serviceAccountName: {{ include "buildachart.serviceAccountName" . }}
      securityContext:
        {{- toYaml .Values.podSecurityContext | nindent 8 }}
      containers:
        - name: {{ .Chart.Name }}
          securityContext:
            {{- toYaml .Values.securityContext | nindent 12 }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag  }}" #| default .Chart.AppVersion
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - name: http
              containerPort: 80
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /
              port: http
          readinessProbe:
            httpGet:
              path: /
              port: http
        - name: postgres #{{ .Chart.Name }}
          securityContext:
            {{- toYaml .Values.securityContext | nindent 12 }}
          image: postgres #"{{ .Values.image.repository1 }}:{{ .Values.image.tag }}" #| default .Chart.AppVersion
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          env:
          - name: POSTGRES_USER
            value: "{{ .Values.user }}" #"user"
          - name: POSTGRES_PASSWORD
            value: "{{ .Values.password }}" #"password"
          - name: POSTGRES_DB
            value: "{{ .Values.db }}" #"test"
          volumeMounts:
          - name: postgres_sql
            mountPath: /var/lib/postgresql/data
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
      {{- with .Values.nodeSelector }}
      volumes:
      - name: postgres_sql
        hostPath:
          path: /data/postgresdb_path
          type: Directory
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
      {{- end }}
我尝试将卷直接放在容器选项卡下,然后放在第二个postgre容器的名称选项卡下,但结果相同

工作Yaml文件

apiVersion: apps/v1
kind: Deployment
metadata:
  name: drupal
spec:
  selector:
    matchLabels:
      app: drupal
  template:
    metadata:
      labels:
        app: drupal
    spec:
      containers:
      - name: drupal
        image: drupal
        resources:
          limits:
            memory: "128Mi"
            cpu: "500m"
      - name: postgres
        image: postgres
        env:
        - name: POSTGRES_USER
          value: test
        - name: POSTGRES_PASSWORD
          value: passwd
        volumeMounts:
        - name: postgres_vol
          mountPath: /var/lib/postgresql/data
        resources:
          limits:
            memory: "128Mi"
            cpu: "500m"
        ports:
        - containerPort: 80
      volumes: 
      - name: test-volume
        hostPath:
        - path: /data
          type: Directory

安装此图表时,是否在头盔值中传递
节点选择器
?您可以使用不同的方法来避免对特定节点的依赖吗?您可以共享values.yaml文件吗?完成后,请在主线程上向下滚动它看起来与缩进有关,因为平面部署yaml工作时没有任何问题