Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: K8S在IPv4环境下部署失败,pd容器一直丢失地址,并不断重启
[TiDB Usage Environment] Test/PoC
[TiDB Version] tidb v6.5.8, ti-operator v1.5.2
[Reproduction Path] Installation and Deployment
[Encountered Issue: Problem Phenomenon and Impact] PD keeps restarting after installation in K8S environment
[Resource Configuration]
[Attachments: Screenshots/Logs/Monitoring]
docker Version: 20.10.2
k8s Version: v1.23.17
Using the default yaml configuration file for K8S deployment.
PD shows the phenomenon of IP address loss during the running process:
node1:/# kubectl -n name-space exec -ti basic-pd-1 – sh
/ # ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:500 (500.0 B) TX bytes:500 (500.0 B)
/ # command terminated with exit code 137
PD logs are as follows:
Server: 10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local
Name: basic-pd-1.basic-pd-peer.name-space.svc
Address 1: 100.74.135.23
nslookup domain basic-pd-1.basic-pd-peer.name-space.svc.svc success
starting pd-server …
/pd-server --data-dir=/var/lib/pd --name=basic-pd-1 --peer-urls=http://0.0.0.0:2380 --advertise-peer-urls=http://basic-pd-1.basic-pd-peer.name-space.svc:2380 --client-urls=http://0.0.0.0:2379 --advertise-client-urls=http://basic-pd-1.basic-pd-peer.name-space.svc:2379 --config=/etc/pd/pd.toml
[2024/06/19 07:39:57.435 +00:00] [INFO] [util.go:43] [“Welcome to Placement Driver (PD)”]
[2024/06/19 07:39:57.435 +00:00] [INFO] [util.go:44] [PD] [release-version=v6.5.8]
[2024/06/19 07:39:57.435 +00:00] [INFO] [util.go:45] [PD] [edition=Community]
[2024/06/19 07:39:57.435 +00:00] [INFO] [util.go:46] [PD] [git-hash=4506d63ba4fba7123ecc8277da7ef5f635efee90]
[2024/06/19 07:39:57.435 +00:00] [INFO] [util.go:47] [PD] [git-branch=heads/refs/tags/v6.5.8]
[2024/06/19 07:39:57.435 +00:00] [INFO] [util.go:48] [PD] [utc-build-time=“2024-01-25 10:03:20”]
[2024/06/19 07:39:57.435 +00:00] [INFO] [metricutil.go:83] [“disable Prometheus push client”]
[2024/06/19 07:39:57.435 +00:00] [INFO] [server.go:253] [“PD Config”] [config=“{"client-urls":"http://0.0.0.0:2379","peer-urls":"http://0.0.0.0:2380","advertise-client-urls":"http://basic-pd-1.basic-pd-peer.name-space.svc:2379","advertise-peer-urls":"http://basic-pd-1.basic-pd-peer.name-space.svc:2380","name":"basic-pd-1","data-dir":"/var/lib/pd","force-new-cluster":false,"enable-grpc-gateway":true,"initial-cluster":"basic-pd-1=http://basic-pd-1.basic-pd-peer.name-space.svc:2380","initial-cluster-state":"new","initial-cluster-token":"pd-cluster","join":"","lease":3,"log":{"level":"info","format":"text","disable-timestamp":false,"file":{"filename":"","max-size":0,"max-days":0,"max-backups":0},"development":false,"disable-caller":false,"disable-stacktrace":false,"disable-error-verbose":true,"sampling":null,"error-output-path":""},"tso-save-interval":"3s","tso-update-physical-interval":"50ms","enable-local-tso":false,"metric":{"job":"basic-pd-1","address":"","interval":"15s"},"schedule":{"max-snapshot-count":64,"max-pending-peer-count":64,"max-merge-region-size":20,"max-merge-region-keys":0,"split-merge-interval":"1h0m0s","swtich-witness-interval":"1h0m0s","enable-one-way-merge":"false","enable-cross-table-merge":"true","patrol-region-interval":"10ms","max-store-down-time":"30m0s","max-store-preparing-time":"48h0m0s","leader-schedule-limit":4,"leader-schedule-policy":"count","region-schedule-limit":2048,"replica-schedule-limit":64,"merge-schedule-limit":8,"hot-region-schedule-limit":4,"hot-region-cache-hits-threshold":3,"store-limit":{},"tolerant-size-ratio":0,"low-space-ratio":0.8,"high-space-ratio":0.7,"region-score-formula-version":"v2","scheduler-max-waiting-operator":5,"enable-remove-down-replica":"true","enable-replace-offline-replica":"true","enable-make-up-replica":"true","enable-remove-extra-replica":"true","enable-location-replacement":"true","enable-debug-metrics":"false","enable-joint-consensus":"true","enable-tikv-split-region":"true","schedulers-v2":[{"type":"balance-region","args":null,"disable":false,"args-payload":""},{"type":"balance-leader","args":null,"disable":false,"args-payload":""},{"type":"hot-region","args":null,"disable":false,"args-payload":""},{"type":"split-bucket","args":null,"disable":false,"args-payload":""}],"schedulers-payload":null,"store-limit-mode":"manual","hot-regions-write-interval":"10m0s","hot-regions-reserved-days":7,"enable-diagnostic":"false","enable-witness":"false"},"replication":{"max-replicas":3,"location-labels":"","strictly-match-label":"false","enable-placement-rules":"true","enable-placement-rules-cache":"false","isolation-level":""},"pd-server":{"use-region-storage":"true","max-gap-reset-ts":"24h0m0s","key-type":"table","runtime-services":"","metric-storage":"","dashboard-address":"auto","trace-region-flow":"true","flow-round-by-digit":3,"min-resolved-ts-persistence-interval":"1s"},"cluster-version":"0.0.0","labels":{},"quota-backend-bytes":"8GiB","auto-compaction-mode":"periodic","auto-compaction-retention-v2":"1h","TickInterval":"500ms","ElectionInterval":"3s","PreVote":true,"max-request-bytes":157286400,"security":{"cacert-path":"","cert-path":"","key-path":"","cert-allowed-cn":null,"SSLCABytes":null,"SSLCertBytes":null,"SSLKEYBytes":null,"redact-info-log":false,"encryption":{"data-encryption-method":"plaintext","data-key-rotation-period":"168h0m0s","master-key":{"type":"plaintext","key-id":"","region":"","endpoint":"","path":""}}},"label-property":null,"WarningMsgs":null,"DisableStrictReconfigCheck":false,"HeartbeatStreamBindInterval":"1m0s","LeaderPriorityCheckInterval":"1m0s","dashboard":{"tidb-cacert-path":"","tidb-cert-path":"","tidb-key-path":"","public-path-prefix":"","internal-proxy":false,"enable-telemetry":false,"enable-experimental":false},"replication-mode":{"replication-mode":"majority","dr-auto-sync":{"label-key":"","primary":"","dr":"","primary-replicas":0,"dr-replicas":0,"wait-store-timeout":"1m0s","pause-region-split":"false"}}}”]
[2024/06/19 07:39:57.443 +00:00] [INFO] [server.go:228] [“register REST path”] [path=/pd/api/v1]
[2024/06/19 07:39:57.443 +00:00] [INFO] [server.go:228] [“register REST path”] [path=/pd/api/v2/]
[2024/06/19 07:39:57.443 +00:00] [INFO] [server.go:228] [“register REST path”] [path=/autoscaling]
[2024/06/19 07:39:57.443 +00:00] [INFO] [distro.go:51] [“Using distribution strings”] [strings={}]
[2024/06/19 07:39:57.445 +00:00] [INFO] [server.go:228] [“register REST path”] [path=/dashboard/api/]
[2024/06/19 07:39:57.445 +00:00] [INFO] [server.go:228] [“register REST path”] [path=/dashboard/]
[2024/06/19 07:39:57.445 +00:00] [INFO] [etcd.go:117] [“configuring peer listeners”] [listen-peer-urls=“[http://0.0.0.0:2380]”]
[2024/06/19 07:39:57.445 +00:00] [INFO] [etcd.go:127] [“configuring client listeners”] [listen-client-urls=“[http://0.0.0.0:2379]”]
[2024/06/19 07:39:57.446 +00:00] [INFO] [etcd.go:611] [“pprof is enabled”] [path=/debug/pprof]
[2024/06/19 07:39:57.446 +00:00] [INFO] [systimemon.go:30] [“start system time monitor”]
[2024/06/19 07:39:57.446 +00:00] [INFO] [etcd.go:305] [“starting an etcd server”] [etcd-version=3.4.21] [git-sha=“Not provided (use ./build instead of go build)”] [go-version=go1.19.13] [go-os=linux] [go-arch=amd64] [max-cpu-set=16] [max-cpu-available=16] [member-initialized=true] [name=basic-pd-1] [data-dir=/var/lib/pd] [wal-dir=] [wal-dir-dedicated=] [member-dir=/var/lib/pd/member] [force-new-cluster=false] [heartbeat-interval=500ms] [election-timeout=3s] [initial-election-tick-advance=true] [snapshot-count=100000] [snapshot-catchup-entries=5000] [initial-advertise-peer-urls=“[http://basic-pd-1.basic-pd-peer.name-space.svc:2380]”] [listen-peer-urls=“[http://0.0.0.0:2380]”] [advertise-client-urls=“[http://basic-pd-1.basic-pd-peer.name-space.svc:2379]”] [listen-client-urls=“[http://0.0.0.0:2379]”] [listen-metrics-urls=“”] [cors=“[]“] [host-whitelist=”[]”] [initial-cluster=] [initial-cluster-state=new] [initial-cluster-token=] [quota-backend-bytes=8589934592] [max-request-bytes=157286400] [max-concurrent-streams=4294967295] [pre-vote=true] [initial-corrupt-check=false] [corrupt-check-time-interval=0s] [auto-compaction-mode=periodic] [auto-compaction-retention=1h0m0s] [auto-compaction-interval=1h0m0s] [discovery-url=] [discovery-proxy=]
[2024/06/19 07:39:57.446 +00:00] [WARN] [server.go:297] [“exceeded recommended request limit”] [max-request-bytes=157286400] [max-request-size=“157 MB”] [recommended-request-bytes=10485760] [recommended-request-size=“10 MB”]
2024-06-19 07:39:57.446236 W | pkg/fileutil: check file permission: directory “/var/lib/pd” exist, but the permission is “drwxr-xr-x”. The recommended permission is “-rwx------” to prevent possible unprivileged access to the data.
[2024/06/19 07:39:57.453 +00:00] [INFO] [backend.go:80] [“opened backend db”] [path=/var/lib/pd/member/snap/db] [took=7.123285ms]
[2024/06/19 07:39:57.478 +00:00] [INFO] [raft.go:586] [“restarting local member”] [cluster-id=dd0f8a758c7a4da3] [local-member-id=1ceea2c50a83b82a] [commit-index=5715]
[2024/06/19 07:39:57.479 +00:00] [INFO] [raft.go:1523] [“1ceea2c50a83b82a switched to configuration voters=()”]
[2024/06/19 07:39:57.479 +00:00] [INFO] [raft.go:706] [“1ceea2c50a83b82a became follower at term 29”]
[2024/06/19 07:39:57.479 +00:00] [INFO] [raft.go:389] [“newRaft 1ceea2c50a83b82a [peers: , term: 29, commit: 5715, applied: 0, lastindex: 5715, lastterm: 29]”]
[2024/06/19 07:39:57.479 +00:00] [WARN] [store.go:1379] [“simple token is not cryptographically signed”]
[2024/06/19 07:39:57.490 +00:00] [INFO] [quota.go:126] [“enabled backend quota”] [quota-name=v3-applier] [quota-size-bytes=8589934592] [quota-size=“8.6 GB”]
[2024/06/19 07:39:57.491 +00:00] [INFO] [server.go:816] [“starting etcd server”] [local-member-id=1ceea2c50a83b82a] [local-server-version=3.4.21] [cluster-version=to_be_decided]
[2024/06/19 07:39:57.491 +00:00] [INFO] [server.go:704] [“starting initial election tick advance”] [election-ticks=6]
[2024/06/19 07:39:57.491 +00:00] [INFO] [raft.go:1523] [“1ceea2c50a83b82a switched to configuration voters=(2084782644687779882)”]
[2024/06/19 07:39:57.491 +00:00] [INFO] [cluster.go:392] [“added member”] [cluster-id=dd0f8a758c7a4da3] [local-member-id=1ceea2c50a83b82a] [added-peer-id=1ceea2c50a83b82a] [added-peer-peer-urls=“[http://basic-pd-1.basic-pd-peer.name-space.svc:2380]”]
[2024/06/19 07:39:57.492 +00:00] [INFO] [cluster.go:558] [“set initial cluster version”] [cluster-id=dd0f8a758c7a4da3] [local-member-id=1ceea2c50a83b82a] [cluster-version=3.4]
[2024/06/19 07:39:57.492 +00:00] [INFO] [capability.go:76] [“enabled capabilities for version”] [cluster-version=3.4]
[2024/06/19 07:39:57.492 +00:00] [INFO] [raft.go:1523] [“1ceea2c50a83b82a switched to configuration voters=(2084782644687779882 11509752368320045231)”]
[2024/06/19 07:39:57.492 +00:00] [INFO] [cluster.go:392] [“added member”] [cluster-id=dd0f8a758c7a4da3] [local-member-id=1ceea2c50a83b82a] [added-peer-id=9fbadacc366d60af] [added-peer-peer-urls=“[http://basic-pd-2.basic-pd-peer.name-space.svc:2380]”]
[2024/06/19 07:39:57.492 +00:00] [INFO] [peer.go:128] [“starting remote peer”] [remote-peer-id=9fbadacc366d60af]
[2024/06/19 07:39:57.492 +00:00] [INFO] [pipeline.go:71] [“started HTTP pipelining with remote peer”] [local-member-id=1ceea2c50a83b82a] [remote-peer-id=9fbadacc366d60af]