~/kubernetes/db$ kubectl create -f statefulset.yaml
error: error validating "statefulset.yaml": error validating data: ValidationError(StatefulSet.spec): missing required field "selector" in io.k8s.api.apps.v1.StatefulSetSpec; if you choose to ignore these errors, turn validation off with --validate=false
segue o meu yaml:
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: statefulset-mysql
spec:
serviceName: db
template:
metadata:
labels:
name: mysql
spec:
containers:
- name: container-mysql
image: mysql:5.7.19
ports:
- containerPort: 3306
env:
- name: MYSQL_DATABASE
value: "loja"
- name: MYSQL_USER
value: "root"
- name: MYSQL_ALLOW_EMPTY_PASSWORD
value: "1"
volumeMounts:
- name: volume-mysql
mountPath: /var/lib/mysql
volumes:
- name: volume-mysql
persistentVolumeClaim:
claimName: configuracao-mysql