Altinity / clickhouse-operator

Altinity Kubernetes Operator for ClickHouse creates, configures and manages ClickHouse® clusters running on Kubernetes
https://altinity.com
Apache License 2.0
1.91k stars 461 forks source link

clickhouse-keeper DNS_ERROR #1349

Open lemontree23 opened 8 months ago

lemontree23 commented 8 months ago

don't work namespaceDomainPattern

apiVersion: "clickhouse-keeper.altinity.com/v1"
kind: "ClickHouseKeeperInstallation"
metadata:
  name: clickhouse-keeper
spec:
  namespaceDomainPattern: "%s.svc.cluster.test"
  configuration:
    clusters:
      - name: "chk"
        layout:
          replicasCount: 1
    settings:
      logger/level: "information"
      logger/console: "true"
      listen_host: "0.0.0.0"
      keeper_server/storage_path: /var/lib/clickhouse-keeper
      keeper_server/tcp_port: "2181"
      keeper_server/four_letter_word_white_list: "*"
      keeper_server/coordination_settings/raft_logs_level: "information"
      keeper_server/raft_configuration/server/port: "9444"
      prometheus/endpoint: "/metrics"
      prometheus/port: "7000"
      prometheus/metrics: "true"
      prometheus/events: "true"
      prometheus/asynchronous_metrics: "true"
      prometheus/status_info: "false"
  templates:
    podTemplates:
      - name: default
        spec:
          securityContext:
            fsGroup: 101
          affinity:
            podAntiAffinity:
              requiredDuringSchedulingIgnoredDuringExecution:
                - labelSelector:
                    matchExpressions:
                      - key: "app"
                        operator: In
                        values:
                          - clickhouse-keeper
                  topologyKey: "kubernetes.io/hostname"
          containers:
            - name: clickhouse-keeper
              imagePullPolicy: IfNotPresent
              image: "clickhouse/clickhouse-keeper:24-alpine"
              resources:
                requests:
                  memory: "256M"
                  cpu: "1"
                limits:
                  memory: "4Gi"
                  cpu: "2"
    volumeClaimTemplates:
      - name: log-storage-path
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 10Gi
      - name: snapshot-storage-path
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 10Gi
<Error> bool DB::(anonymous namespace)::isLocalhost(const std::string &): Code: 198. DB::Exception: Not found address of host: clickhouse-keeper-0.clickhouse-keeper-headless.clickhouse.svc.cluster.local. (DNS_ERROR), Stack trace (when copying this message, always include the lines below):

0. DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x0000000000e4435b in /usr/bin/clickhouse-keeper
1. DB::Exception::Exception<String const&>(int, FormatStringHelperImpl<std::type_identity<String const&>::type>, String const&) @ 0x0000000000784c83 in /usr/bin/clickhouse-keeper
2. DB::(anonymous namespace)::resolveIPAddressImpl(String const&) (.llvm.5800006673693014166) @ 0x0000000000e328eb in /usr/bin/clickhouse-keeper
3. DB::DNSResolver::resolveHost(String const&) @ 0x0000000000e324aa in /usr/bin/clickhouse-keeper
4. DB::KeeperStateManager::parseServersConfiguration(Poco::Util::AbstractConfiguration const&, bool, bool) const @ 0x00000000008522b9 in /usr/bin/clickhouse-keeper
5. DB::KeeperStateManager::getRaftConfigurationDiff(Poco::Util::AbstractConfiguration const&, std::shared_ptr<DB::CoordinationSettings> const&) const @ 0x000000000085875b in /usr/bin/clickhouse-keeper
6. DB::KeeperServer::getRaftConfigurationDiff(Poco::Util::AbstractConfiguration const&) @ 0x00000000007f3862 in /usr/bin/clickhouse-keeper
7. DB::KeeperDispatcher::updateConfiguration(Poco::Util::AbstractConfiguration const&, std::shared_ptr<DB::Macros const> const&) @ 0x00000000007d3c58 in /usr/bin/clickhouse-keeper
8. DB::Context::updateKeeperConfiguration(Poco::Util::AbstractConfiguration const&) @ 0x0000000000a5434a in /usr/bin/clickhouse-keeper
9. void std::__function::__policy_invoker<void (Poco::AutoPtr<Poco::Util::AbstractConfiguration>, bool)>::__call_impl<std::__function::__default_alloc_func<DB::Keeper::main(std::vector<String, std::allocator<String>> const&)::$_10, void (Poco::AutoPtr<Poco::Util::AbstractConfiguration>, bool)>>(std::__function::__policy_storage const*, Poco::AutoPtr<Poco::Util::AbstractConfiguration>&&, bool) @ 0x0000000000b8ed05 in /usr/bin/clickhouse-keeper
10. DB::ConfigReloader::reloadIfNewer(bool, bool, bool, bool) @ 0x0000000000e01acc in /usr/bin/clickhouse-keeper
11. DB::ConfigReloader::ConfigReloader(std::basic_string_view<char, std::char_traits<char>>, std::vector<String, std::allocator<String>> const&, String const&, zkutil::ZooKeeperNodeCache&&, std::shared_ptr<Poco::Event> const&, std::function<void (Poco::AutoPtr<Poco::Util::AbstractConfiguration>, bool)>&&, bool) @ 0x0000000000e002a4 in /usr/bin/clickhouse-keeper
12. DB::Keeper::main(std::vector<String, std::allocator<String>> const&) @ 0x0000000000b83f49 in /usr/bin/clickhouse-keeper
13. Poco::Util::Application::run() @ 0x0000000001004f66 in /usr/bin/clickhouse-keeper
14. DB::Keeper::run() @ 0x0000000000b7f99d in /usr/bin/clickhouse-keeper
15. Poco::Util::ServerApplication::run(int, char**) @ 0x000000000100e139 in /usr/bin/clickhouse-keeper
16. mainEntryClickHouseKeeper(int, char**) @ 0x0000000000b7e958 in /usr/bin/clickhouse-keeper
17. main @ 0x0000000000b8f4dd in /usr/bin/clickhouse-keeper
 (version 24.1.5.6 (official build))
ahmadubuntu commented 8 months ago

your log: Not found address of host: clickhouse-keeper-0.clickhouse-keeper-headless.clickhouse.svc.cluster.local. (DNS_ERROR),

your config: namespaceDomainPattern: "%s.svc.cluster.test"

I'm not one of the clickhouse or altinity developers but it seems you should use: namespaceDomainPattern: "%s.svc"

lemontree23 commented 8 months ago

@ahmadubuntu

spec:
  namespaceDomainPattern: "%s.svc"
<Warning> DNSResolver: Cannot resolve host (clickhouse-keeper-0.clickhouse-keeper-headless.clickhouse.svc.cluster.local), error 0: DNS error.
<Error> bool DB::(anonymous namespace)::isLocalhost(const std::string &): Code: 198. DB::Exception: Not found address of host: clickhouse-keeper-0.clickhouse-keeper-headless.clickhouse.svc.cluster.local. (DNS_ERROR)