Error from server (BadRequest): container "mysql-con" in pod "mysql" is waiting to start: CreateContainerConfigError

0 votes

Hi Guys,

I am trying to create one pod on minikube cluster. But it is showing me below error.

$ kubectl logs mysql
Error from server (BadRequest): container "mysql-con" in pod "mysql" is waiting to start: CreateContainerConfigError

I have used this below yml code to create mysql pod.

apiVersion: v1
kind: Pod
metadata:
  name: mysql
  labels:
    name: mysql
spec:
  containers:
  - name: mysql-con
    image: mysql:5.7
    env:
    - name: MYSQL_ROOT_PASSWORD
      valueFrom:
        secretKeyRef:
          name: secret
          key: rootpass
    - name: MYSQL_USER
      value: nadeem
    - name: MYSQL_PASSWORD
      valueFrom:
        secretKeyRef:
          name: secret
          key: userpass
    - name: MYSQL_DATABASE
      value: database
    volumeMounts:
    - name: pvc-vol
      mountPath: /var/lib/mysql
  volumes:
  - name: pvc-vol
    persistentVolumeClaim:
      claimName: pvc-volume

How can I solve this error?

May 22 in Kubernetes by akhtar
• 11,250 points
62 views

1 answer to this question.

0 votes

Hi@akhtar,

In above code, you have used secret for your credentials. But when you build this file, it didn't able to find any secret. Make sure you have created secret resource. You can use the below given code.

apiVersion: v1
kind: Secret
metadata:
  name: secret
data:
  rootpass: 'name'
  userpass: 'value'
$ kubectl create -f secret
answered May 22 by MD
• 24,500 points

Related Questions In Kubernetes

0 votes
1 answer

Pods IP address from inside a container in the pod

Make sure that your pod yaml file ...READ MORE

answered Aug 29, 2018 in Kubernetes by Kalgi
• 51,850 points
442 views
0 votes
1 answer

Not able to access kubernetes api from a pod in azure

Follow these steps Add --bind-address=0.0.0.0 option to the line https://github.com/kubernetes/kubernetes/blob/v1.2.0/docs/getting-started-guides/coreos/azure/cloud_config_templates/kubernetes-cluster-main-nodes-template.yml#L218  Created ...READ MORE

answered Aug 30, 2018 in Kubernetes by Kalgi
• 51,850 points
155 views
0 votes
1 answer
0 votes
2 answers
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17, 2019 in Others by anonymous
6,637 views
+4 votes
1 answer

Installing Web UI (Dashboard):kubernetes-dashboard on main Ubuntu 16.04.6 LTS (Xenial Xerus) server

Follow these steps: $ kubeadm reset $ kubeadm init ...READ MORE

answered Apr 11, 2019 in Kubernetes by Kalgi
• 51,850 points

reshown Apr 12, 2019 by Kalgi 1,971 views
0 votes
1 answer