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, 2020 in Kubernetes by akhtar
• 38,260 points
7,600 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, 2020 by MD
• 95,460 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
• 52,360 points
2,366 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
• 52,360 points
985 views
0 votes
1 answer
+1 vote
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
15,313 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 12, 2019 in Kubernetes by Kalgi
• 52,360 points

reshown Apr 12, 2019 by Kalgi 6,934 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP