[英]Getting cluster type error on helm upgrade
Trying to do:试图做:
helm upgrade --namespace keycloak -f k8s/sandbox/values.yaml keycloak codecentric/keycloak
Getting:得到:
UPGRADE FAILED: cannot patch "keycloak-http" with kind Service: Service "keycloak-http" is invalid: [spec.ports[0].nodePort: Forbidden: may not be used when `type` is 'ClusterIP', spec.ports[1].nodePort: Forbidden: may not be used when `type` is 'ClusterIP']
However, initial values is NodePort, not ClusterIP:但是,初始值是NodePort,而不是 ClusterIP:
service:
# Annotations for headless and HTTP Services
annotations: {}
# Additional labels for headless and HTTP Services
labels: {}
# key: value
# The Service type
type: NodePort
Also kubectl edit shows type: NodePort kubectl edit 还显示类型:NodePort
spec:
clusterIP: <SomeIP>
externalTrafficPolicy: Cluster
ports:
- name: http
nodePort: 31062
port: 80
protocol: TCP
targetPort: http
- name: https
nodePort: 31258
port: 8443
protocol: TCP
targetPort: https
- name: http-management
nodePort: 32113
port: 9990
protocol: TCP
targetPort: http-management
selector:
app.kubernetes.io/instance: keycloak
app.kubernetes.io/name: keycloak
sessionAffinity: None
type: NodePort
Here is the keycloak-http service from helm template
.这是来自helm template
的 keycloak-http 服务。 For some reason it says ClusterIp, but both the inital values.yaml says NodePort and also kubectl edit service keycloak-http say it is NodePort:出于某种原因,它说 ClusterIp,但两个初始值。yaml 说 NodePort 并且 kubectl edit service keycloak-http 说它是 NodePort:
# Source: keycloak/templates/service-http.yaml
apiVersion: v1
kind: Service
metadata:
name: keycloak-http
labels:
helm.sh/chart: keycloak-10.1.0
app.kubernetes.io/name: keycloak
app.kubernetes.io/instance: keycloak
app.kubernetes.io/version: "12.0.4"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: http
spec:
type: ClusterIP
ports:
- name: http
port: 80
targetPort: http
protocol: TCP
- name: https
port: 8443
targetPort: https
protocol: TCP
- name: http-management
port: 9990
targetPort: http-management
protocol: TCP
selector:
app.kubernetes.io/name: keycloak
app.kubernetes.io/instance: keycloak
Any ideas?有任何想法吗?
Please delete the service manually and perform the helm upgrade again请手动删除服务并重新执行helm升级
I pulled the repository and tried changing the values.yaml
to NodePort
and this works fine for me.我拉出存储库并尝试将values.yaml
更改为NodePort
,这对我来说很好。 The template that was printed had NodePort
instead of ClusterIP
.打印的模板有NodePort
而不是ClusterIP
。 This means that you might be doing something wrong or perhaps using some wrong values file.这意味着您可能做错了什么,或者可能使用了一些错误的值文件。
Now the error itself is there because you can't change the service type like that and Kubernetes won't allow it because NodePort
has additional parameter included in the service template:现在错误本身就在那里,因为您不能像那样更改服务类型,并且 Kubernetes 不允许它,因为NodePort
在服务模板中包含其他参数:
"ports": [
{
"name": "http",
"nodePort": 30240,
"port": 8888,
"protocol": "TCP",
"targetPort": "http"
}
While this is the ClusterIP:虽然这是 ClusterIP:
"ports": [
{
"name": "http",
"port": 8888,
"protocol": "TCP",
"targetPort": "http"
}
There are couple of possible workaround for this issue when you attempt to change service like that:当您尝试像这样更改服务时,有几个可能的解决方法来解决此问题:
kubectl edit svc
使用kubectl edit svc
手动更改服务类型
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.