目前,我正在使用Kubernetes 1.11。+版本。以前,我始终在云构建脚本中使用以下命令:
- name: 'gcr.io/cloud-builders/kubectl'
id: 'deploy'
args:
- 'apply'
- '-f'
- 'k8s'
- '--recursive'
env:
- 'CLOUDSDK_COMPUTE_ZONE=${_REGION}'
- 'CLOUDSDK_CONTAINER_CLUSTER=${_CLUSTER_NAME}'
而且这些命令只是按预期工作,当时我使用的是k8s 1.10。+版。但是最近我收到以下错误:
- spec.clusterIP:无效值:“”:字段是不可变的
- metadata.resourceVersion:无效值:“”:必须指定更新
所以我想知道这是否是Service资源的预期行为?
这是我为我的服务配置的YAML:
apiVersion: v1
kind: Service
metadata:
name: {name}
namespace: {namespace}
annotations:
beta.cloud.google.com/backend-config: '{"default": "{backend-config-name}"}'
spec:
ports:
- port: {port-num}
targetPort: {port-num}
selector:
app: {label}
environment: {env}
type: NodePort