kubectl apply -f service.yml引发错误

时间:2019-01-05 17:50:00

标签: kubernetes yaml indentation

  

错误:将YAML转换为JSON时发生错误:yaml:第2行:映射值是   在这种情况下不允许

这是我的服务。yml:

apiVersion: v1
 kind: Service
  metadata:
    name: eureka-service
spec:
  type: LoadBalancer
  ports:
    - port: 8761
      targetPort: 8761
  selector:
    app: eureka-naming-server

我不知道此service.yml有什么问题。我在Google Kubernetes上有一个正在运行的Pod,其标签为:app eureka-naming-server

1 个答案:

答案 0 :(得分:2)

在YAML块样式中,结构由缩进确定。您是否按以下方式分隔文件?:

CREATE NONCLUSTERED INDEX [NonClusteredIndex-20190105-141910] ON [dbo].[TableB]
(
    [BID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]