kubernetes 将YAML转换为JSON时出错:yaml:第4行:找到无法启动任何标记的字符

r3i60tvu  于 2023-06-28  发布在  Kubernetes
关注(0)|答案(1)|浏览(206)

正在尝试从此yaml文件创建部署。我知道一般的解决办法:检查缩进并使用空格代替制表符。还是不行。

apiVersion: apps/v1
kind: Deployment
metadata:
  name: datadog-poc-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: datadog-poc
  template:
    metadata:
      labels:
        app: datadog-poc
    spec:
      containers:
      - name: datadog-poc
        image: <My-Registry>/datadog-poc
        ports:
        - containerPort: 8080

错误:error:分析dd_poc_deployment.yaml时出错:将YAML转换为JSON时出错:yaml:第4行:找到无法启动任何标记的字符

ntjbwcob

ntjbwcob1#

你把制表符和空格弄混了。试试这个:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: datadog-poc-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: datadog-poc
  template:
    metadata:
      labels:
        app: datadog-poc
    spec:
      containers:
      - name: datadog-poc
        image: <My-Registry>/datadog-poc
        ports:
        - containerPort: 8080

相关问题