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,695 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,350 points
2,437 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,350 points
1,015 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,476 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,035 views
0 votes
1 answer
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