Error with a deployment in EKS

0

Hello guys,

I am trying to deploy an app in EKS but my yaml seems to be wrong, could you help? I am new.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: orders
  labels:
    app.kubernetes.io/created-by: eks-workshop
    app.kubernetes.io/type: app
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: orders
      app.kubernetes.io/instance: orders
      app.kubernetes.io/component: service
  template:
    metadata:
      annotations:
        prometheus.io/path: /actuator/prometheus
        prometheus.io/port: "8080"
        prometheus.io/scrape: "true"
      labels:
        app.kubernetes.io/name: orders
        app.kubernetes.io/instance: orders
        app.kubernetes.io/component: service
        app.kubernetes.io/created-by: eks-workshop
    spec:
      serviceAccountName: orders
      securityContext:
        fsGroup: 1000
      containers:
        - name: orders
          env:
            - name: JAVA_OPTS
              value: -XX:MaxRAMPercentage=75.0 -Djava.security.egd=file:/dev/urandom
            - name: SPRING_DATASOURCE_WRITER_URL
              valueFrom:
                name: catalog-mysql
            - name: SPRING_DATASOURCE_WRITER_USERNAME
              valueFrom:
                secretKeyRef:
                  name: mysql-pass
                  key: MYSQL_USER
            - name: SPRING_DATASOURCE_WRITER_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: mysql-pass
                  key: MYSQL_PASSWORD
            - name: SPRING_DATASOURCE_READER_URL
              valueFrom:
                name: catalog-mysql
            - name: SPRING_DATASOURCE_READER_USERNAME
              valueFrom:
                secretKeyRef:
                  name: mysql-pass
                  key: MYSQL_USER
            - name: SPRING_DATASOURCE_READER_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: mysql-pass
                  key: MYSQL_PASSWORD
          envFrom:
            - configMapRef:
                name: orders
          securityContext:
            capabilities:
              drop:
              - ALL
            readOnlyRootFilesystem: true
            runAsNonRoot: true
            runAsUser: 1000
          image: "public.ecr.aws/aws-containers/retail-store-sample-orders:0.4.0"
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 8080
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /actuator/health/liveness
              port: 8080
            initialDelaySeconds: 45
            periodSeconds: 3
          readinessProbe:
            httpGet:
              path: /actuator/health/liveness
              port: 8080
            successThreshold: 3
            periodSeconds: 5
          resources:
            limits:
              memory: 1Gi
            requests:
              cpu: 250m
              memory: 1Gi
          volumeMounts:
             - name: persistent-storage
               mountPath: /data/backend
      volumes:
              - name: persistent-storage
                persistentVolumeClaim:
                  claimName: efs-claim


Error from server (BadRequest): error when creating "deployment-orders.yaml": Deployment in version "v1" cannot be handled as a Deployment: strict decoding error: unknown field "spec.template.spec.containers[0].env[1].valueFrom.name", unknown field "spec.template.spec.containers[0].env[4].valueFrom.name"
Allan
asked 7 months ago260 views
1 Answer
0

Hello.

From the content of the error, it seems that the problem is in the following parts.

            - name: SPRING_DATASOURCE_WRITER_URL
              valueFrom:
                name: catalog-mysql
            - name: SPRING_DATASOURCE_READER_URL
              valueFrom:
                name: catalog-mysql
profile picture
EXPERT
answered 7 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions