You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Cloud Code报错:两个Kubernetes YAML文件apiVersion/kind不被识别

解决Cloud Code报"apiVersion/kind不识别"的问题

你的两个Kubernetes YAML文件配置本身完全合法:

  • Deployment使用apps/v1是K8s 1.9+的标准apiVersion
  • Service使用v1是K8s通用稳定版apiVersion

出现这个报错大概率是Cloud Code本地配置或缓存问题,试试以下方案:

  • 检查Kubernetes版本匹配
    Cloud Code需要和你使用的集群(或本地minikube/k3s等)版本对应。打开Cloud Code设置,确认Kubernetes API schema版本与集群版本一致,或者开启"自动检测集群版本加载schema"的选项。

  • 刷新Cloud Code的Schema缓存
    Cloud Code会缓存Kubernetes API的schema定义,缓存异常会导致误报。在IDE中执行Cloud Code的"Refresh Kubernetes Schemas"命令,或者在Kubernetes面板点击刷新按钮,强制更新schema缓存。

  • 确认文件类型关联
    确保IDE将这两个文件识别为Kubernetes YAML类型。右键文件,选择"Configure File Association",将.yaml后缀关联到Kubernetes YAML,让IDE加载对应的schema校验规则。

  • 重启IDE和Cloud Code插件
    插件进程异常可能引发这类无意义报错,重启IDE后重新打开文件,多数情况下能解决缓存或加载异常问题。


你提供的原始文件内容:

manifest.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nodered-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nodered
  template:
    metadata:
      labels:
        app: nodered
    spec:
      containers:
        - name: nodered
          image: nodered/node-red
          ports:
            - containerPort: 1880

nodered-service.yaml(注:原文件名拼写为nordered-service.yaml,应为nodered-service.yaml)

apiVersion: v1
kind: Service
metadata:
  name: nodered-service
spec:
  type: LoadBalancer
  selector:
    app: nodered
  ports:
    - name: http
      port: 80
      targetPort: 1880

内容的提问来源于stack exchange,提问作者user30128602

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 14:52:02