【问题标题】:Unable to create POD in kubernetes1 Getting error无法在 kubernetes1 中创建 POD 出现错误
【发布时间】:2020-09-27 09:28:09
【问题描述】:

我正在学习 Kubernetes 并使用 configmap 创建一个 Pod。我创建了一个 yaml 文件来创建一个 POD。但我遇到了错误

error: error parsing yuvi.yaml: error conversion YAML to JSON: YAML: line 13: mapping values are not allowed in this context

我的配置图名称:yuviconfigmap

YAML 文件:


apiVersion: v1
kind: Pod
metadata:
 name: yuvipod1
spec:
 containers:
   - name: yuvicontain
     image: nginx
     volumeMounts:
     - name: yuvivolume
        mountPath: /etc/voulme
  volumes:
  - name: yuvivolume
    configMap:
      name: yuviconfigmap

【问题讨论】:

  • 请将您的 yaml 文件写入 ``` ``` 以正确显示并欢迎
  • 当然泰伯!!感谢您的信息

标签: kubernetes


【解决方案1】:

yaml 不符合 kubernetes 的预期。下面应该可以工作。

apiVersion: v1
kind: Pod
metadata:
  name: yuvipod1
spec:
  containers:
  - name: yuvicontain
    image: nginx
    volumeMounts:
    - name: yuvivolume
      mountPath: /etc/voulme
  volumes:
    - name: yuvivolume
      configMap:
        name: yuviconfigmap

【讨论】:

猜你喜欢
  • 2020-05-04
  • 1970-01-01
  • 1970-01-01
  • 2021-12-23
  • 2015-10-31
  • 2016-08-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多