Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 自托管k8s上部署TiDB,最后使用TidbInitializer初始化TiDB的时候,初始化失败
[TiDB Usage Environment]
System: CentOS Linux release 7.5.1804 (Core) Kernel Version: 4.4.161-1.el7.elrepo.x86_64
[TiDB Version]
v6.5.0
[Reproduction Path]
Kubernetes 上的 TiDB 集群环境需求 | PingCAP 文档中心 Self-hosted Kubernetes Step 5: Initialize TiDB Cluster
[Encountered Issue: Phenomenon and Impact]
Initialization failed when using TidbInitializer to initialize TiDB
[Resource Configuration]
[Attachments: Screenshots/Logs/Monitoring]
-
Cluster deployment information:
-
Log information from pod/tidb-cluster-demo-tidb-initializer-8plz9 waitercontainer:
-
From the second image, it can be seen that the required tidb-cluster-demo-tidb:4000 for initialization has not been created
-
Related configuration files:
crd.yaml (1.8 MB)
tidb-initializer.yaml (538 bytes)
tidb-cluster.yaml (36.4 KB)
local-volume-provisioner.yaml (2.9 KB)
TiFlash and Pump haven’t been created, sts is 0, please confirm the reason first.
Thank you very much, I will first investigate the cause. 
Hello, the issue of TiFlash and Pump not being created has been resolved.
Deployment information is as follows:
However, the previous initialization failure issue still exists. Unable to connect to tidb-cluster-demo-tidb:4000 (I suspect this is a service).
Partial information from k -n tidb-cluster describe pod/tidb-cluster-demo-tidb-initializer-wc9zf
is as follows:
Below is the error information from the wait
container in the Init Containers of pod/tidb-cluster-demo-tidb-initializer-wc9zf:
Please help take a look, thank you very much. 
I found another issue. Not only was the service for tidb-cluster-demo-tidb not created, but the pod for tidb-cluster-demo-tidb was also not created. Below is my tidb-cluster.yaml file, where I have already set up tidb and also configured tidb.service.
Check where the operator’s logs are stuck.
Sorry, how do I check the operator logs? I only found this document 运维 - 查看日志 - 《TiDB in Kubernetes 用户文档 v1.2》 - 书栈网 · BookStack
kubectl -n {ns} logs -f tidb-controller-manager-xxxx
Thank you very much. The TiDB pod and service have been created.
Now there are still some issues with pod/tidb-cluster-demo-tidb-initializer-s7mks. Below is part of the information from the describe command.
Entering the container: mysql-client in pod/tidb-cluster-demo-tidb-initializer-s7mks, the error is shown below.
Below is tidb-initializer.yaml
Access denied, refer to Kubernetes 上的集群初始化配置 | PingCAP 文档中心 for configuration.
It was set up according to this document. Previously, I set up tidb-secret and encountered the same error, so I deleted tidb-secret. Now I’m logging in without a password.