Minikube集群中的Pod状态为"CreateContainerConfigError"

编程入门 行业动态 更新时间:2024-10-23 07:39:43
本文介绍了Minikube集群中的Pod状态为"CreateContainerConfigError"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用以下 helm图表运行Sonarqube服务.

I am trying to run Sonarqube service using the following helm chart.

因此设置类似于在minikube集群中启动MySQL和Sonarqube服务,而Sonarqube服务与MySQL服务进行通信以转储数据.

So the set-up is like it starts a MySQL and Sonarqube service in the minikube cluster and Sonarqube service talks to the MySQL service to dump the data.

当我依次执行helm install和kubectl get pods时,我看到MySQL窗格状态为running,但是Sonarqube pos状态显示为CreateContainerConfigError.我认为这与安装量有关:链接.尽管我不太确定如何解决它(对于Kubernetes环境来说还很陌生,直到学习:))

When I do helm install followed by kubectl get pods I see the MySQL pod status as running, but the Sonarqube pos status shows as CreateContainerConfigError. I reckon it has to do with the mounting volume thingy: link. Although I am not quite sure how to fix it (pretty nnew to Kubernetes environment and till learning :) )

推荐答案

我今天在尝试创建机密并将其用于pod定义yaml文件中时遇到了这个问题.如果您正在检查kubectl get secrets和kubectl get configmaps的输出,并使用它们验证它们的正确性,则将很有帮助.

I ran into this problem myself today as I was trying to create secrets and using them in my pod definition yaml file. It would help if you check the output of kubectl get secrets and kubectl get configmaps if you are using any of them and validate if the # of data items you wanted are listed correctly.

我认识到我的问题是,当我们创建包含多个数据项的机密时:kubectl get secrets <secret_name>的输出只有1个数据项,而我在secret_name_definition.yaml中指定了2个项.这是因为使用kubectl create -f secret_name_definition.yaml与kubectl create secret <secret_name> --from-file=secret_name_definition.yaml之间存在差异,不同之处在于,对于前者,yaml数据部分中列出的所有项目都将被视为键值对,因此#当我们使用kubectl get secrets secret_name查询时,这些项目将显示为正确的输出,但对于后者,仅对secret_name_definition.yaml中的第一个数据项进行键值对评估,因此,kubectl get secrets secret_name的输出将仅显示1个数据项,这是当我们看到错误"CreateContainerConfigError"时.

I recognized that in my case problem was that when we create secrets with multiple data items: the output of kubectl get secrets <secret_name> had only 1 item of data while I had specified 2 items in my secret_name_definition.yaml. This is because of the difference between using kubectl create -f secret_name_definition.yaml vs kubectl create secret <secret_name> --from-file=secret_name_definition.yaml The difference is that in the case of the former, all the items listed in the data section of the yaml will be considered as key-value pairs and hence the # of items will be shown as the correct output when we query using kubectl get secrets secret_name but in the case of the latter only the first data item in the secret_name_definition.yaml will be evaluated for the key-value pairs and hence the output of kubectl get secrets secret_name will show only 1 data item and this is when we see the error "CreateContainerConfigError".

请注意,如果我们将kubectl create secret <secret_name>与选项--from-literal=一起使用,则不会发生此问题,因为那样的话,我们必须为要定义的每个键值对使用前缀--from-literal=.

Note that this problem wouldn't occur if we use kubectl create secret <secret_name> with the options --from-literal= because then we would have to use the prefix --from-literal= for every key-value pair we want to define.

类似地,如果我们使用--from-file=选项,我们仍然必须多次指定前缀,每个键值对一次,但是只是当我们使用--from-literal时我们可以传递键的原始值和编码形式(即,当我们使用--from-file时,键的值现在将作为值的echo raw_value | base64.

Similarly, if we are using --from-file= option, we still have to specify the prefix multiple times, one for each key-value pair, but just that we can pass the raw value of the key when we use --from-literal and the encoded form (i.e. value of the key will now be echo raw_value | base64 of it as a value when we use --from-file.

例如,假设密钥是用户名"和密码",如果使用命令kubectl create -f secret_definition.yaml创建密钥,我们需要对用户名"和密码"的值进行编码,如创建"中所述 kubernetes.io/docs的秘密"部分/tasks/inject-data-application/distribute-credentials-secure/

For example, say the keys are "username" and "password", if creating the secret using the command kubectl create -f secret_definition.yaml we need to have the values for both "username" and "password" encoded as mentioned in the "Create a Secret" section of kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/

我想突出显示 kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/另外, kubernetes.io/docs/concepts/configuration/secret/对创建机密的解释很清楚

I would like to highlight the "Note:" section in kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/ Also, kubernetes.io/docs/concepts/configuration/secret/ has a very clear explanation of creating secrets

还请确保Deployment.yaml现在对该容器具有正确的定义:

Also make sure that the deployment.yaml now has the correct definiton for this container:

env: - name: DB_HOST value: 127.0.0.1 # These secrets are required to start the pod. # [START cloudsql_secrets] - name: DB_USER valueFrom: secretKeyRef: name: cloudsql-db-credentials key: username - name: DB_PASSWORD valueFrom: secretKeyRef: name: cloudsql-db-credentials key: password # [END cloudsql_secrets]

正如其他人所引用的,"kubectl describe pods pod_name"会有所帮助,但是在我的情况下,我只明白并不是首先创建了容器,并且"kubectl logs pod_name -c container_name"的输出并没有太大帮助.

As quoted by others, "kubectl describe pods pod_name" would help but in my case I only understood that the container wasn't being created first of all and the output of "kubectl logs pod_name -c container_name" didn't help much.

更多推荐

Minikube集群中的Pod状态为"CreateContainerConfigError"

本文发布于:2023-11-25 14:04:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1630055.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:集群   状态   Minikube   Pod   CreateContainerConfigError

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!