cant run mysql statefulset in kubernetes

Ivan Koblyk :

I've just started learning kubernetes and was playing around in katakoda platform. I created a statefulset for mysql. It is just a test so i didnt declare any pvc and mount any volumes. It's declaration and the service's declaration in yml:


---

apiVersion: v1
kind: Service
metadata:
  name: mysql-headless
  labels:
    run: mysql-sts-demo
spec:
  ports:
  - port: 3306
    name: db
  selector:
    run: mysql-sts-demo

---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: mysql-sts-demo
spec:
  serviceName: "mysql-headless"
  replicas: 1
  selector:
    matchLabels:
      run: mysql-sts-demo
  template:
    metadata:
      labels:
        run: mysql-sts-demo
    spec:
      containers:
      - name: mysql
        image: mysql:5.7.8
        env:
          - name: MYSQL_ROOT_PASSWORD
            valueFrom:
              secretKeyRef:
                name: mysql-secrets
                key: ROOT_PASSWORD
          - name: MYSQL_DATABASE
            valueFrom:
              secretKeyRef:
                name: mysql-secrets
                key: DBNAME
          - name: MYSQL_USER
            valueFrom:
              secretKeyRef:
                name: mysql-secret
                key: USER
          - name: MYSQL_PASSWORD
            valueFrom:
              secretKeyRef:
                name: mysql-secrets
                key: PASSWORD


it creates those resources successfully , but when I type kubectl get statefulsets , my ss is always being displayed as not ready. What may the issue be? Btw I need it for using with a spring petclinic app which I declared and launched previously as a deployment .

Ashish Kamat :

can you paste the logs for statefulsets or an output of kubectl get events and kubectl describe <your stateful-set name>

now coming to secrets can you check whether those secrets which you are using in your stateful-sets definitions are already present using kubectl get secrets

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Kubernetes mysql statefulset with root password

Mysql query cant run in mssql

kubernetes mysql statefulset not taking new password, though password changes in env

Adding Hospath to a Kubernetes Statefulset

Helm / Kubernetes - Statefulset & Permissions

kubernetes creating statefulset fail

Kubernetes Admission webhook for Statefulset

apply HPA for Statefulset in kubernetes?

Running DB as Kubernetes Deployment or StatefulSet?

StatefulSet volume mounts for OrientDB in Kubernetes

Redeploy statefulset with CrashLoopBackOff status in kubernetes

How to sync a folder in kubernetes statefulset

"UnknownHostException": Zookeeper 3.5.3 and StatefulSet Kubernetes

Kubernetes trouble with StatefulSet and 3 PersistentVolumes

How to set pvc with statefulset in kubernetes?

Error on StatefulSet creation for mongodb on Kubernetes

Kubernetes: How to run MySQL command?

MySQL statefulset with persistent storage on minikube

Configure starting index of StatefulSet's pods in Kubernetes

why the postgersql kubernetes statefulset did not claim the PVC

Kubernetes 1.16 deprecation of daemonset, statefulset, deployments and replicasets

kubernetes timescaledb statefulset: Changes lost on pod recreation

SQL Server Kubernetes StatefulSet deployment not ready

Kubernetes: StorageClass with local provisioner and StatefulSet kind

How to expose a headless service for a StatefulSet externally in Kubernetes

Add persistent volume in Kubernetes StatefulSet on Minikube

How to get number of replicas of StatefulSet Kubernetes

Adding a volume to a Kubernetes StatefulSet using kubectl patch

not able to access statefulset headless service from kubernetes