根据提供的信息,第九行应该是 'ipFamilies' 的定义。根据 Kubernetes 官方文档,'ipFamilies' 属性应该放在 'spec' 下面,而不是 'ipFamilyPolicy' 的下面。因此,可以尝试将第8行和第9行位置互换,使其符合规范:

spec:
  ipFamilies:
    - IPv4
    - IPv6
  ipFamilyPolicy: RequireDualStack

修改后的 YAML 文件如下:

apiVersion: v1
kind: Service
metadata:
  name: dw-lancelot
  labels:
    app: dw
spec:
  ipFamilyPolicy: RequireDualStack
  ports:
    - port: 8888
      targetPort: 8888
      nodePort: 31111
      protocol: TCP
      name: http-port
  type: NodePort
  selector:
    app: dw
    tier: lancelot
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: dw-lancelot
  labels:
    app: dw
spec:
  selector:
    matchLabels:
      app: dw
      tier: lancelot
  replicas: 1
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: dw
        tier: lancelot
    spec:
      containers:
        - name: dw-lancelot
          #image: registry.paas/cmss/lancelot-service:ci-20230303102714
          image: registry.paas/cmss/lancelot-service:20230425143355
          resources:
            limits:
              cpu: 4000m
              memory: 2048Mi
            requests:
              cpu: 1000m
              memory: 1024Mi
          volumeMounts:
            - mountPath: "/var/lib/docs"
              name: epic-docs
            - mountPath: "/var/log/deepwatch"
              name: epic-logs
          ports:
            - containerPort: 8888
              name: http-port
      volumes:
        - name: epic-docs
          hostPath:
            path: "/apps/docs"
        - name: epic-logs
          hostPath:
            path: "/apps/logs"

注意,这只是一种可能的解决方案。如果问题仍然存在,请提供更多详细信息,以便更好地诊断问题。

Kubernetes YAML 文件启动报错:`ipFamilies` 映射问题

原文地址: https://www.cveoy.top/t/topic/ox3Q 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录