k8s的k8s-slave节点加入失败[ERROR FileAvailable--etc-kubernetes-kubelet.conf]: /etc/kubernetes...

k8s的k8s-slave节点加入失败[ERROR FileAvailable--etc-kubernetes-kubelet.conf]: /etc/kubernetes...

[root@k8s-slave2 ~]# kubeadm join 192.168.72.136:6443 --token abcdef.0123456789abcdef \
> --discovery-token-ca-cert-hash sha256:5a654691520b6d27f482734b241b7f4ec2704b3537fb3dd1cb4ad6adc821003a 
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
	[ERROR FileAvailable--etc-kubernetes-kubelet.conf]: /etc/kubernetes/kubelet.conf already exists
	[ERROR Port-10250]: Port 10250 is in use
	[ERROR FileAvailable--etc-kubernetes-pki-ca.crt]: /etc/kubernetes/pki/ca.crt already exists
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher
[root@k8s-slave2 ~]# kubeadm reset
W1102 14:43:59.458552   13624 preflight.go:55] [reset] WARNING: Changes made to this host by 'kubeadm init' or 'kubeadm join' will be reverted.
[reset] Are you sure you want to proceed? [y/N]: y
[preflight] Running pre-flight checks
W1102 14:44:01.011235   13624 removeetcdmember.go:84] [reset] No kubeadm config, using etcd pod spec to get data directory
[reset] No etcd config found. Assuming external etcd
[reset] Please, manually reset etcd to prevent further issues
[reset] Stopping the kubelet service
[reset] Unmounting mounted directories in "/var/lib/kubelet"
[reset] Deleting contents of directories: [/etc/kubernetes/manifests /etc/kubernetes/pki]
[reset] Deleting files: [/etc/kubernetes/admin.conf /etc/kubernetes/kubelet.conf /etc/kubernetes/bootstrap-kubelet.conf /etc/kubernetes/controller-manager.conf /etc/kubernetes/scheduler.conf]
[reset] Deleting contents of stateful directories: [/var/lib/kubelet /var/lib/dockershim /var/run/kubernetes /var/lib/cni]

The reset process does not clean CNI configuration. To do so, you must remove /etc/cni/net.d

The reset process does not reset or clean up iptables rules or IPVS tables.
If you wish to reset iptables, you must do so manually by using the "iptables" command.

If your cluster was setup to utilize IPVS, run ipvsadm --clear (or similar)
to reset your system's IPVS tables.

The reset process does not clean your kubeconfig files and you must remove them manually.
Please, check the contents of the $HOME/.kube/config file.
[root@k8s-slave2 ~]# 
[root@k8s-slave2 ~]# 
[root@k8s-slave2 ~]# kubeadm join 192.168.72.136:6443 --token abcdef.0123456789abcdef --discovery-token-ca-cert-hash sha256:5a654691520b6d27f482734b241b7f4ec2704b3537fb3dd1cb4ad6adc821003a 
[preflight] Running pre-flight checks
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Starting the kubelet
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...

This node has joined the cluster:
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details.

Run 'kubectl get nodes' on the control-plane to see this node join the cluster.

 

 

### 配置 Docker Compose 文件以运行带有自定义配置的 Redis 容器 为了正确设置 Docker Compose 文件并启动带有自定义 `redis.conf` 的 Redis 容器,可以按照以下方式编写 `docker-compose.yml` 文件: #### 1. 创建自定义 `redis.conf` 首先,在本地创建一个名为 `redis.conf` 的文件,并对其进行必要的修改。例如,取消绑定默认地址以便允许外部访问[^1]。 ```conf # 取消 bind,默认情况下 Redis 绑定到 localhost (127.0.0.1),需要将其注释掉或更改为其他 IP 地址。 # bind 127.0.0.1 ::1 bind 0.0.0.0 # 设置密码(可选) requirepass your_password_here # 修改客户端缓冲区限制(如果需要) client-output-buffer-limit normal 0 0 0 client-output-buffer-limit slave 0 0 0 client-output-buffer-limit pubsub 0 0 0 ``` #### 2. 编写 `docker-compose.yml` 以下是完整的 `docker-compose.yml` 文件示例,其中包含了挂载自定义 `redis.conf` 到容器中的逻辑以及指定使用的 Redis 版本[^3]。 ```yaml version: '3.8' services: redis: image: redis:7.2.3 container_name: redis-container ports: - "6379:6379" volumes: # 将主机上的 ./redis.conf 挂载到容器内的 /usr/local/etc/redis/redis.conf 路径下 - ./redis.conf:/usr/local/etc/redis/redis.conf command: ["redis-server", "/usr/local/etc/redis/redis.conf"] networks: - app-network networks: app-network: driver: bridge ``` 上述配置说明如下: - 使用官方镜像 `redis:7.2.3` 来启动 Redis 容器[^4]。 - 映射端口 `6379`,使宿主机能够访问 Redis 实例。 - 使用 `volumes` 参数将本地目录下的 `redis.conf` 文件挂载至容器内部路径 `/usr/local/etc/redis/redis.conf` 中。 - 使用 `command` 参数覆盖默认命令,确保 Redis 启动时加载自定义配置文件。 #### 3. 运行 Docker Compose 完成以上步骤后,可以通过以下命令启动服务: ```bash docker-compose up -d ``` 此命令将以分离模式启动 Redis 容器,并自动应用所定义的配置。 --- ### 注意事项 - 如果希望 Redis 支持持久化存储,则可以在 `volumes` 下增加数据卷映射,例如 `- ./data:/data`,并将 `dir` 或 `appendonly` 等选项添加到 `redis.conf` 文件中。 - 确保 `redis.conf` 文件具有正确的权限,必要时可通过 `chmod` 命令调整其执行权限。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值