wangzhigang1999 commented on code in PR #7846: URL: https://github.com/apache/kyuubi/pull/7846#discussion_r4577914935
########## docs/deployment/high_availability_guide.md: ########## @@ -64,6 +64,113 @@ But it doesn't have any availability to being highly available. For production deployment purpose, an external zookeeper cluster is required for `kyuubi.ha.addresses`. In this mode, multiple `k.i.`s can be registered to the same ServerSpace configured by `kyuubi.ha.namespace` and serve together. +### etcd for server and engine discovery + +Kyuubi can use [etcd](https://etcd.io/) as the discovery ensemble instead of +ZooKeeper. Set the following on every Kyuubi server (for example via a shared +`kyuubi-defaults.conf`): + +```text +kyuubi.ha.client.class=org.apache.kyuubi.ha.client.etcd.EtcdDiscoveryClient +# endpoint URLs must include a scheme: http://, or https:// when TLS is enabled +kyuubi.ha.addresses=http://etcd1:2379,http://etcd2:2379,http://etcd3:2379 +# optional, defaults to "kyuubi" +kyuubi.ha.namespace=kyuubi +# optional, defaults to PT10S +kyuubi.ha.etcd.lease.timeout=PT10S +``` + +If your etcd uses TLS, set `kyuubi.ha.etcd.ssl.enabled=true` together with the +ca/certificate/key paths: `kyuubi.ha.etcd.ssl.ca.path`, +`kyuubi.ha.etcd.ssl.client.certificate.path`, +`kyuubi.ha.etcd.ssl.client.key.path`, and use `https://` endpoint URLs in +`kyuubi.ha.addresses`. + +Notes: + +- There is no embedded etcd equivalent to the embedded ZooKeeper in pseudo + mode. etcd must run as a service, either inside the Kubernetes cluster + (for example a dedicated StatefulSet) or outside it. +- `kyuubi.ha.addresses` is a comma-separated list of endpoint URLs that + include a scheme: `http://host:port`, or `https://host:port` when TLS is + enabled. Bare `host:port` addresses will not connect. +- The etcd discovery client has no authentication other than mTLS; secure etcd + with TLS or a network boundary. +- Server registrations and engine registrations both use the same namespace. +- The JDBC driver does not support etcd service discovery; + `serviceDiscoveryMode` only works with a ZooKeeper ensemble. etcd is used + between Kyuubi servers and engines, not from the JDBC client. + +## High Availability on Kubernetes (with etcd) + +A production Kubernetes deployment of Kyuubi has three moving parts: the +Kyuubi servers, their engines (Spark applications), and the discovery store +they share. A Kubernetes Service can balance new connections across the +servers, but it does not make engines discoverable or sessions portable, so a +discovery store is required for a real HA setup. + +1. **Deploy etcd for discovery.** Any etcd cluster reachable from the Kyuubi + pods works, for example a dedicated StatefulSet in the same namespace, or an + etcd cluster running outside Kubernetes. Kyuubi does *not* use the + Kubernetes cluster's own etcd automatically; you must pass the endpoints to + Kyuubi with `kyuubi.ha.addresses`. +2. **Configure every server with the same options.** All server replicas must + use the same `kyuubi.ha.client.class` and `kyuubi.ha.namespace`. Engines + inherit their discovery configuration from the server that starts them, so + engine driver pods must also be able to reach etcd; server-only + connectivity is not enough and engine startup fails without it. When TLS Review Comment: Could we link the Spark on Kubernetes guide here and call out the driver namespace and ServiceAccount? In my Kubernetes test cluster, the first JDBC query failed because Spark tried to create the driver pod in `default`, where the ServiceAccount lacked permission. After I set `spark.kubernetes.namespace`, both Kyuubi replicas reused the same Spark engine. ########## docs/deployment/high_availability_guide.md: ########## @@ -64,6 +64,113 @@ But it doesn't have any availability to being highly available. For production deployment purpose, an external zookeeper cluster is required for `kyuubi.ha.addresses`. In this mode, multiple `k.i.`s can be registered to the same ServerSpace configured by `kyuubi.ha.namespace` and serve together. +### etcd for server and engine discovery + +Kyuubi can use [etcd](https://etcd.io/) as the discovery ensemble instead of +ZooKeeper. Set the following on every Kyuubi server (for example via a shared +`kyuubi-defaults.conf`): + +```text +kyuubi.ha.client.class=org.apache.kyuubi.ha.client.etcd.EtcdDiscoveryClient +# endpoint URLs must include a scheme: http://, or https:// when TLS is enabled +kyuubi.ha.addresses=http://etcd1:2379,http://etcd2:2379,http://etcd3:2379 +# optional, defaults to "kyuubi" +kyuubi.ha.namespace=kyuubi +# optional, defaults to PT10S +kyuubi.ha.etcd.lease.timeout=PT10S +``` + +If your etcd uses TLS, set `kyuubi.ha.etcd.ssl.enabled=true` together with the +ca/certificate/key paths: `kyuubi.ha.etcd.ssl.ca.path`, +`kyuubi.ha.etcd.ssl.client.certificate.path`, +`kyuubi.ha.etcd.ssl.client.key.path`, and use `https://` endpoint URLs in +`kyuubi.ha.addresses`. + +Notes: + +- There is no embedded etcd equivalent to the embedded ZooKeeper in pseudo + mode. etcd must run as a service, either inside the Kubernetes cluster + (for example a dedicated StatefulSet) or outside it. +- `kyuubi.ha.addresses` is a comma-separated list of endpoint URLs that + include a scheme: `http://host:port`, or `https://host:port` when TLS is + enabled. Bare `host:port` addresses will not connect. +- The etcd discovery client has no authentication other than mTLS; secure etcd + with TLS or a network boundary. +- Server registrations and engine registrations both use the same namespace. +- The JDBC driver does not support etcd service discovery; + `serviceDiscoveryMode` only works with a ZooKeeper ensemble. etcd is used + between Kyuubi servers and engines, not from the JDBC client. + +## High Availability on Kubernetes (with etcd) + +A production Kubernetes deployment of Kyuubi has three moving parts: the +Kyuubi servers, their engines (Spark applications), and the discovery store +they share. A Kubernetes Service can balance new connections across the +servers, but it does not make engines discoverable or sessions portable, so a +discovery store is required for a real HA setup. + +1. **Deploy etcd for discovery.** Any etcd cluster reachable from the Kyuubi + pods works, for example a dedicated StatefulSet in the same namespace, or an + etcd cluster running outside Kubernetes. Kyuubi does *not* use the + Kubernetes cluster's own etcd automatically; you must pass the endpoints to + Kyuubi with `kyuubi.ha.addresses`. +2. **Configure every server with the same options.** All server replicas must + use the same `kyuubi.ha.client.class` and `kyuubi.ha.namespace`. Engines + inherit their discovery configuration from the server that starts them, so + engine driver pods must also be able to reach etcd; server-only + connectivity is not enough and engine startup fails without it. When TLS + is enabled, the driver pods also need the configured certificate files at + the inherited paths, because forwarding the configuration does not copy + them. Mount a shared `kyuubi-defaults.conf` (or inject it into the Helm + chart values) so this is identical on every pod. +3. **Let clients connect through the Service.** Point the JDBC driver at the + Kyuubi Service (LoadBalancer or NodePort), for example + `jdbc:kyuubi://<service-host>:10009/default`. Session stickiness is tied to Review Comment: Could we show `jdbc:kyuubi://<node-ip>:<nodePort>/default` for clients connecting through NodePort from outside the cluster? In a server-side dry run, Kubernetes allocated NodePort `32769` for Service port `10009`. ########## docs/deployment/high_availability_guide.md: ########## @@ -64,6 +64,113 @@ But it doesn't have any availability to being highly available. For production deployment purpose, an external zookeeper cluster is required for `kyuubi.ha.addresses`. In this mode, multiple `k.i.`s can be registered to the same ServerSpace configured by `kyuubi.ha.namespace` and serve together. +### etcd for server and engine discovery + +Kyuubi can use [etcd](https://etcd.io/) as the discovery ensemble instead of +ZooKeeper. Set the following on every Kyuubi server (for example via a shared +`kyuubi-defaults.conf`): + +```text +kyuubi.ha.client.class=org.apache.kyuubi.ha.client.etcd.EtcdDiscoveryClient +# endpoint URLs must include a scheme: http://, or https:// when TLS is enabled +kyuubi.ha.addresses=http://etcd1:2379,http://etcd2:2379,http://etcd3:2379 +# optional, defaults to "kyuubi" +kyuubi.ha.namespace=kyuubi +# optional, defaults to PT10S +kyuubi.ha.etcd.lease.timeout=PT10S +``` + +If your etcd uses TLS, set `kyuubi.ha.etcd.ssl.enabled=true` together with the +ca/certificate/key paths: `kyuubi.ha.etcd.ssl.ca.path`, +`kyuubi.ha.etcd.ssl.client.certificate.path`, +`kyuubi.ha.etcd.ssl.client.key.path`, and use `https://` endpoint URLs in +`kyuubi.ha.addresses`. + +Notes: + +- There is no embedded etcd equivalent to the embedded ZooKeeper in pseudo + mode. etcd must run as a service, either inside the Kubernetes cluster + (for example a dedicated StatefulSet) or outside it. +- `kyuubi.ha.addresses` is a comma-separated list of endpoint URLs that + include a scheme: `http://host:port`, or `https://host:port` when TLS is + enabled. Bare `host:port` addresses will not connect. +- The etcd discovery client has no authentication other than mTLS; secure etcd + with TLS or a network boundary. +- Server registrations and engine registrations both use the same namespace. Review Comment: Could we clarify that the engine’s registration prefix is derived from the server namespace? In my test, the servers registered under `/kyuubi` and the Spark engine registered under `/kyuubi_1.13.0-SNAPSHOT_USER_SPARK_SQL/review7846/default`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
