Closed shenzhu closed 1 year ago
Do you mean service clickhouse-{chi-name}-{cluster-name} didn't created? I see in logs
E0731 00:27:54.258470 1 worker.go:1207] updateService():clickhouse-operator/small/04a5fa26-4934-4bf9-a93f-b1b0364db208:Update Service clickhouse-operator/clickhouse-small
failed with error Service "clickhouse-small" is invalid: spec.loadBalancerClass: Invalid value: "null": may not change once set
Which clichouse-operator
version do you use? did you sync CRDS?
Could you share?
kubectl get deploy -l app=clickhouse-operator -o yaml
kubectl get crd clickhouseinstallations.clickhouse.altinity.com -o jsonpath='{.metadata.labels}'
Your password changes are not related to any kubernetes services
clickhouse-operator
deployment use clickhouse_operator
user by default to interaction with clickhouse-server pods
default/networks/ip: "::/0"
better will not open default
user without a password from any IP
Hey @Slach , thanks for your reply!
Yeah, at first when we apply the clickhouse-cluster.yaml
, the service for the cluster clickhouse-{chi-name}-{cluster-name}
can be created successfully, but after I made the password change and use kubectl apply -f clickhouse-cluster.yaml -n clickhouse-operator
to apply the changes, the service for the cluster disappeared.
And as the log says, I can find some error logs related to the service, but not sure if it's related to our EKS setup or not
E0731 00:27:54.258470 1 worker.go:1207] updateService():clickhouse-operator/small/04a5fa26-4934-4bf9-a93f-b1b0364db208:Update Service clickhouse-operator/clickhouse-small failed with error Service "clickhouse-small" is invalid: spec.loadBalancerClass: Invalid value: "null": may not change once set
I0731 00:27:55.660814 1 deleter.go:327] clickhouse-operator/clickhouse-small:OK delete Service clickhouse-operator/clickhouse-small
E0731 00:27:55.858509 1 worker.go:1232] createService():clickhouse-operator/small/04a5fa26-4934-4bf9-a93f-b1b0364db208:Create Service clickhouse-operator/clickhouse-small failed with error Service "clickhouse-small" is invalid: spec.clusterIPs: Invalid value: []string{"192.168.25.164"}: failed to allocate IP 192.168.25.164: provided IP is already allocated
E0731 00:27:56.875412 1 worker-reconciler.go:661] reconcileService():clickhouse-operator/small/04a5fa26-4934-4bf9-a93f-b1b0364db208:FAILED to reconcile Service: clickhouse-small CHI: small
Here're the commands and output
kubectl get deploy -l app=clickhouse-operator -o yaml -n clickhouse-operator
apiVersion: v1
items:
- apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "1"
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"labels":{"app":"clickhouse-operator","clickhouse.altinity.com/chop":"0.21.2"},"name":"clickhouse-operator","namespace":"clickhouse-operator"},"spec":{"replicas":1,"selector":{"matchLabels":{"app":"clickhouse-operator"}},"template":{"metadata":{"annotations":{"prometheus.io/port":"8888","prometheus.io/scrape":"true"},"labels":{"app":"clickhouse-operator"}},"spec":{"containers":[{"env":[{"name":"OPERATOR_POD_NODE_NAME","valueFrom":{"fieldRef":{"fieldPath":"spec.nodeName"}}},{"name":"OPERATOR_POD_NAME","valueFrom":{"fieldRef":{"fieldPath":"metadata.name"}}},{"name":"OPERATOR_POD_NAMESPACE","valueFrom":{"fieldRef":{"fieldPath":"metadata.namespace"}}},{"name":"OPERATOR_POD_IP","valueFrom":{"fieldRef":{"fieldPath":"status.podIP"}}},{"name":"OPERATOR_POD_SERVICE_ACCOUNT","valueFrom":{"fieldRef":{"fieldPath":"spec.serviceAccountName"}}},{"name":"OPERATOR_CONTAINER_CPU_REQUEST","valueFrom":{"resourceFieldRef":{"containerName":"clickhouse-operator","resource":"requests.cpu"}}},{"name":"OPERATOR_CONTAINER_CPU_LIMIT","valueFrom":{"resourceFieldRef":{"containerName":"clickhouse-operator","resource":"limits.cpu"}}},{"name":"OPERATOR_CONTAINER_MEM_REQUEST","valueFrom":{"resourceFieldRef":{"containerName":"clickhouse-operator","resource":"requests.memory"}}},{"name":"OPERATOR_CONTAINER_MEM_LIMIT","valueFrom":{"resourceFieldRef":{"containerName":"clickhouse-operator","resource":"limits.memory"}}}],"image":"altinity/clickhouse-operator:latest","imagePullPolicy":null,"name":"clickhouse-operator","volumeMounts":[{"mountPath":"/etc/clickhouse-operator","name":"etc-clickhouse-operator-folder"},{"mountPath":"/etc/clickhouse-operator/conf.d","name":"etc-clickhouse-operator-confd-folder"},{"mountPath":"/etc/clickhouse-operator/config.d","name":"etc-clickhouse-operator-configd-folder"},{"mountPath":"/etc/clickhouse-operator/templates.d","name":"etc-clickhouse-operator-templatesd-folder"},{"mountPath":"/etc/clickhouse-operator/users.d","name":"etc-clickhouse-operator-usersd-folder"}]},{"env":[{"name":"OPERATOR_POD_NODE_NAME","valueFrom":{"fieldRef":{"fieldPath":"spec.nodeName"}}},{"name":"OPERATOR_POD_NAME","valueFrom":{"fieldRef":{"fieldPath":"metadata.name"}}},{"name":"OPERATOR_POD_NAMESPACE","valueFrom":{"fieldRef":{"fieldPath":"metadata.namespace"}}},{"name":"OPERATOR_POD_IP","valueFrom":{"fieldRef":{"fieldPath":"status.podIP"}}},{"name":"OPERATOR_POD_SERVICE_ACCOUNT","valueFrom":{"fieldRef":{"fieldPath":"spec.serviceAccountName"}}},{"name":"OPERATOR_CONTAINER_CPU_REQUEST","valueFrom":{"resourceFieldRef":{"containerName":"clickhouse-operator","resource":"requests.cpu"}}},{"name":"OPERATOR_CONTAINER_CPU_LIMIT","valueFrom":{"resourceFieldRef":{"containerName":"clickhouse-operator","resource":"limits.cpu"}}},{"name":"OPERATOR_CONTAINER_MEM_REQUEST","valueFrom":{"resourceFieldRef":{"containerName":"clickhouse-operator","resource":"requests.memory"}}},{"name":"OPERATOR_CONTAINER_MEM_LIMIT","valueFrom":{"resourceFieldRef":{"containerName":"clickhouse-operator","resource":"limits.memory"}}}],"image":"altinity/metrics-exporter:latest","imagePullPolicy":null,"name":"metrics-exporter","ports":[{"containerPort":8888,"name":"metrics"}],"volumeMounts":[{"mountPath":"/etc/clickhouse-operator","name":"etc-clickhouse-operator-folder"},{"mountPath":"/etc/clickhouse-operator/conf.d","name":"etc-clickhouse-operator-confd-folder"},{"mountPath":"/etc/clickhouse-operator/config.d","name":"etc-clickhouse-operator-configd-folder"},{"mountPath":"/etc/clickhouse-operator/templates.d","name":"etc-clickhouse-operator-templatesd-folder"},{"mountPath":"/etc/clickhouse-operator/users.d","name":"etc-clickhouse-operator-usersd-folder"}]}],"serviceAccountName":"clickhouse-operator","volumes":[{"configMap":{"name":"etc-clickhouse-operator-files"},"name":"etc-clickhouse-operator-folder"},{"configMap":{"name":"etc-clickhouse-operator-confd-files"},"name":"etc-clickhouse-operator-confd-folder"},{"configMap":{"name":"etc-clickhouse-operator-configd-files"},"name":"etc-clickhouse-operator-configd-folder"},{"configMap":{"name":"etc-clickhouse-operator-templatesd-files"},"name":"etc-clickhouse-operator-templatesd-folder"},{"configMap":{"name":"etc-clickhouse-operator-usersd-files"},"name":"etc-clickhouse-operator-usersd-folder"}]}}}}
creationTimestamp: "2023-07-17T22:00:10Z"
generation: 1
labels:
app: clickhouse-operator
clickhouse.altinity.com/app: chop
clickhouse.altinity.com/chop: 0.21.2
clickhouse.altinity.com/chop-commit: 32ef0fa
clickhouse.altinity.com/chop-date: 2023-06-29T09.08.10
name: clickhouse-operator
namespace: clickhouse-operator
resourceVersion: "105804355"
uid: cf3a2bae-4846-4aae-b191-452eec79ca3e
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: clickhouse-operator
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
annotations:
prometheus.io/port: "8888"
prometheus.io/scrape: "true"
creationTimestamp: null
labels:
app: clickhouse-operator
spec:
containers:
- env:
- name: OPERATOR_POD_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
- name: OPERATOR_POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: OPERATOR_POD_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: OPERATOR_POD_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
- name: OPERATOR_POD_SERVICE_ACCOUNT
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.serviceAccountName
- name: OPERATOR_CONTAINER_CPU_REQUEST
valueFrom:
resourceFieldRef:
containerName: clickhouse-operator
divisor: "0"
resource: requests.cpu
- name: OPERATOR_CONTAINER_CPU_LIMIT
valueFrom:
resourceFieldRef:
containerName: clickhouse-operator
divisor: "0"
resource: limits.cpu
- name: OPERATOR_CONTAINER_MEM_REQUEST
valueFrom:
resourceFieldRef:
containerName: clickhouse-operator
divisor: "0"
resource: requests.memory
- name: OPERATOR_CONTAINER_MEM_LIMIT
valueFrom:
resourceFieldRef:
containerName: clickhouse-operator
divisor: "0"
resource: limits.memory
image: altinity/clickhouse-operator:latest
imagePullPolicy: Always
name: clickhouse-operator
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /etc/clickhouse-operator
name: etc-clickhouse-operator-folder
- mountPath: /etc/clickhouse-operator/conf.d
name: etc-clickhouse-operator-confd-folder
- mountPath: /etc/clickhouse-operator/config.d
name: etc-clickhouse-operator-configd-folder
- mountPath: /etc/clickhouse-operator/templates.d
name: etc-clickhouse-operator-templatesd-folder
- mountPath: /etc/clickhouse-operator/users.d
name: etc-clickhouse-operator-usersd-folder
- env:
- name: OPERATOR_POD_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
- name: OPERATOR_POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: OPERATOR_POD_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: OPERATOR_POD_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
- name: OPERATOR_POD_SERVICE_ACCOUNT
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.serviceAccountName
- name: OPERATOR_CONTAINER_CPU_REQUEST
valueFrom:
resourceFieldRef:
containerName: clickhouse-operator
divisor: "0"
resource: requests.cpu
- name: OPERATOR_CONTAINER_CPU_LIMIT
valueFrom:
resourceFieldRef:
containerName: clickhouse-operator
divisor: "0"
resource: limits.cpu
- name: OPERATOR_CONTAINER_MEM_REQUEST
valueFrom:
resourceFieldRef:
containerName: clickhouse-operator
divisor: "0"
resource: requests.memory
- name: OPERATOR_CONTAINER_MEM_LIMIT
valueFrom:
resourceFieldRef:
containerName: clickhouse-operator
divisor: "0"
resource: limits.memory
image: altinity/metrics-exporter:latest
imagePullPolicy: Always
name: metrics-exporter
ports:
- containerPort: 8888
name: metrics
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /etc/clickhouse-operator
name: etc-clickhouse-operator-folder
- mountPath: /etc/clickhouse-operator/conf.d
name: etc-clickhouse-operator-confd-folder
- mountPath: /etc/clickhouse-operator/config.d
name: etc-clickhouse-operator-configd-folder
- mountPath: /etc/clickhouse-operator/templates.d
name: etc-clickhouse-operator-templatesd-folder
- mountPath: /etc/clickhouse-operator/users.d
name: etc-clickhouse-operator-usersd-folder
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
serviceAccount: clickhouse-operator
serviceAccountName: clickhouse-operator
terminationGracePeriodSeconds: 30
terminationGracePeriodSeconds: 30
volumes:
- configMap:
defaultMode: 420
name: etc-clickhouse-operator-files
name: etc-clickhouse-operator-folder
- configMap:
defaultMode: 420
name: etc-clickhouse-operator-confd-files
name: etc-clickhouse-operator-confd-folder
- configMap:
defaultMode: 420
name: etc-clickhouse-operator-configd-files
name: etc-clickhouse-operator-configd-folder
- configMap:
defaultMode: 420
name: etc-clickhouse-operator-templatesd-files
name: etc-clickhouse-operator-templatesd-folder
- configMap:
defaultMode: 420
name: etc-clickhouse-operator-usersd-files
name: etc-clickhouse-operator-usersd-folder
status:
availableReplicas: 1
conditions:
- lastTransitionTime: "2023-07-17T22:00:10Z"
lastUpdateTime: "2023-07-17T22:00:15Z"
message: ReplicaSet "clickhouse-operator-7b7fb5dc7b" has successfully progressed.
reason: NewReplicaSetAvailable
status: "True"
type: Progressing
- lastTransitionTime: "2023-07-18T15:16:55Z"
lastUpdateTime: "2023-07-18T15:16:55Z"
message: Deployment has minimum availability.
reason: MinimumReplicasAvailable
status: "True"
type: Available
observedGeneration: 1
readyReplicas: 1
replicas: 1
updatedReplicas: 1
kind: List
metadata:
resourceVersion: ""
kubectl get crd clickhouseinstallations.clickhouse.altinity.com -o jsonpath='{.metadata.labels}'
{"clickhouse.altinity.com/chop":"0.21.2"}%
Just curious @shenzhu, is the indentation of admin/password correct in the original YAML or is that an artifact of the diff?
@sunsingerus ^ any ideas?
@shenzhu are you sure you have only one instance of clickhouse-operator?
could you share
kubectl get deploy --all-namespaces | grep operator
?
do you have any ClickHouseInstallationTemplate resources?
kubectl get chit --all-namespaces
?
@shenzhu @hodgesrm @Slach Current vision of the situation is like the following. Post-mortem
LoadBalancerClass
assigned to a service created in EKS.LoadBalancerClass
at the moment - this behavior is a subject of modification - and tries to update service with default 'missing' value@shenzhu please try with 0.22.0 version - it is already available
Hey team, thanks so much for your help! We will try the new version 0.22.0.
On our side, we tried some workarounds for this issue:
Option 1
We are operating Kubernetes in AWS EKS, and are using AWS Load Balancer Controller. The first fix we tried is to specify the loadBalancerClass
to service.k8s.aws/nlb
, something like the following
...
serviceTemplates:
- name: service-clickhouse
spec:
loadBalancerClass: service.k8s.aws/nlb
ports:
- name: http
port: 8123
- name: client
port: 9000
type: LoadBalancer
Option 2 Instead of relying on Kubernetes LoadBalancer to provide external access, we tried adding a Ingress layer in front. In this case the Service doesn't has to be LoadBalancer, so we changed it to ClusterIP and updated the Ingress to connect to this ClusterIP. Something like following
...
serviceTemplates:
- name: service
spec:
ports:
- name: http
port: 8123
- name: client
port: 9000
type: ClusterIP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: clickhouse
spec:
ingressClassName: nginx-internal
rules:
- host: small.clickhouse.cluster
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: clickhouse-small
port:
number: 8123
cc. @hodgesrm @sunsingerus @Slach
Hey team, thanks so much for your help! We will try the new version 0.22.0.
On our side, we tried some workarounds for this issue:
Option 1 We are operating Kubernetes in AWS EKS, and are using AWS Load Balancer Controller. The first fix we tried is to specify the
loadBalancerClass
toservice.k8s.aws/nlb
, something like the following... serviceTemplates: - name: service-clickhouse spec: loadBalancerClass: service.k8s.aws/nlb ports: - name: http port: 8123 - name: client port: 9000 type: LoadBalancer
Option 2 Instead of relying on Kubernetes LoadBalancer to provide external access, we tried adding a Ingress layer in front. In this case the Service doesn't has to be LoadBalancer, so we changed it to ClusterIP and updated the Ingress to connect to this ClusterIP. Something like following
... serviceTemplates: - name: service spec: ports: - name: http port: 8123 - name: client port: 9000 type: ClusterIP --- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: clickhouse spec: ingressClassName: nginx-internal rules: - host: small.clickhouse.cluster http: paths: - path: / pathType: Prefix backend: service: name: clickhouse-small port: number: 8123
cc. @hodgesrm @sunsingerus @Slach
I wonder how to connect to the clickhouse via the exported ingress?
I do the same thing and want to export clickhouse for external access, but i can't connect to the clickhouse server via the clickhouse-client -h
Hi @alazyer , I think the host specified in the Ingress won't work automatically, the underlying infra needs to be updated to support it externally.
It has been reproduced and fixed in 0.22
Hey team, we are working on a poc to run ClickHouse clusters with this operator, our Kubernetes cluster is hosted on AWS EKS.
The following yaml config for ClickHouse cluster was used:
After a small change to the password of admin account(see the changes above), the service for this ClickHouse cluster disappeared
Also tried the fetching logs from the operator pod with command
kubectl logs clickhouse-operator-7b7fb5dc7b-qqfrv -n clickhouse-operator --since=30m