This is my mysql-deployment.yaml, I am trying to make it run on kubernetes but I am getting the error, I have mentioned the error below in my deployment.yml
apiVersion: v1 kind: Service metadata: name: mysql labels: app: mysql tier: database spec: ports: - port: 3306 targetPort: 3306 selector: app: mysql tier: database clusterIP: None --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: mysql-pv-claim labels: app: mysql tier: database spec: accessMode: - ReadWriteOnce resources: requests: storage: 1Gi --- apiVersion: apps/v1 kind: Deployment metadata: name: mysql labels: app: mysql tier: database spec: selector: matchLabels: app: mysql tier: database strategy: type: Recreate template: metadata: labels: apps: mysql tier: database spec: containers: - image: mysql:5.7 name: mysql env: - name: MYSQL_ROOT_PASSWORD valueFrom: secretKeyRef: name: db-root-credentials key: password - name: MYSQL_USER valueFrom: secretKeyRef:: name: db-credentials key: username - name: MYSQL_PASSWORD valueFrom: secretkeyRef: name: db-credentials key: password - name: MYSQL_DATABASE valueFrom: configMapKeyRef: name: dbbuddyto_mstr_local key: name ports: - containerPort: 3306 name: mysql volumeMounts: - name: mysql-persistent-storage mountPath: /var/lib/mysql volumes: - name: mysql-persistent-storage PersistentVolumeClaim: claimName: mysql-pv-claim
I get two errors:
Error while parsing mysql-deployment.yml: Error converting YAML to JSON: yaml: line 24: Map value not allowed in this context
The second error is
Error from server (BadRequest): Error creating 'mysql-deployment.yml': PersistentVolumeClaim in version 'v1' cannot be handled as a PersistentVolumeClaim: Strict decoding error: Unknown field 'spec.accessMode'
p>
I'm trying to build a Kubernetes deployment for Angular, Spring and mysql. The above error is the one I am currently facing.
Your PVC question is a typo. It needs to be
spec.accessModes
, you missed the last s.edit: