rancher 证书过期网页进不去 问题解决

2024-05-09 11:04

本文主要是介绍rancher 证书过期网页进不去 问题解决,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

参考文章:https://docs.rancher.cn/docs/rancher2.5/cluster-admin/certificate-rotation/_index/#%E6%A6%82%E8%BF%B0

一、问题故障描述:

查看 rancher 容器 日志

docker logs --tail 100 dfc1ef8e4f29

提示以下信息:

2024/05/07 08:49:58 [INFO] Waiting for server to become available: Get "https://127.0.0.1:6443/version?timeout=15m0s": x509: certificate has expired or is not yet valid: current time 2024-05-07T08:49:58Z is after 2023-08-12T12:40:53Z
time="2024-05-07T08:49:58.286554030Z" level=info msg="Waiting for master node  startup: resource name may not be empty"
2024-05-07 08:49:58.658786 I | http: TLS handshake error from 127.0.0.1:44498: remote error: tls: bad certificate
2024-05-07 08:49:58.660633 I | http: TLS handshake error from 127.0.0.1:44500: remote error: tls: bad certificate
time="2024-05-07T08:49:58.660725073Z" level=error msg="server https://127.0.0.1:6443/cacerts is not trusted: Get https://127.0.0.1:6443/cacerts: x509: certificate has expired or is not yet valid"
time="2024-05-07T08:49:59.286748842Z" level=info msg="Waiting for master node  startup: resource name may not be empty"
2024-05-07 08:50:00.214517 I | http: TLS handshake error from 127.0.0.1:44502: remote error: tls: bad certificate
2024/05/07 08:50:00 [INFO] Waiting for server to become available: Get "https://127.0.0.1:6443/version?timeout=15m0s": x509: certificate has expired or is not yet valid: current time 2024-05-07T08:50:00Z is after 2023-08-12T12:40:53Z
time="2024-05-07T08:50:00.286991654Z" level=info msg="Waiting for master node  startup: resource name may not be empty"
2024-05-07 08:50:00.662312 I | http: TLS handshake error from 127.0.0.1:44504: remote error: tls: bad certificate
2024-05-07 08:50:00.663978 I | http: TLS handshake error from 127.0.0.1:44506: remote error: tls: bad certificate
time="2024-05-07T08:50:00.664045071Z" level=error msg="server https://127.0.0.1:6443/cacerts is not trusted: Get https://127.0.0.1:6443/cacerts: x509: certificate has expired or is not yet valid"
time="2024-05-07T08:50:01.287238713Z" level=info msg="Waiting for master node  startup: resource name may not be empty"
2024/05/07 08:50:02 [INFO] Waiting for server to become available: Get "https://127.0.0.1:6443/version?timeout=15m0s": x509: certificate has expired or is not yet valid: current time 2024-05-07T08:50:02Z is after 2023-08-12T12:40:53Z
2024-05-07 08:50:02.216587 I | http: TLS handshake error from 127.0.0.1:44508: remote error: tls: bad certificate
time="2024-05-07T08:50:02.287535519Z" level=info msg="Waiting for master node  startup: resource name may not be empty"
2024-05-07 08:50:02.666576 I | http: TLS handshake error from 127.0.0.1:44510: remote error: tls: bad certificate
2024-05-07 08:50:02.668689 I | http: TLS handshake error from 127.0.0.1:44512: remote error: tls: bad certificate
time="2024-05-07T08:50:02.668753807Z" level=error msg="server https://127.0.0.1:6443/cacerts is not trusted: Get https://127.0.0.1:6443/cacerts: x509: certificate has expired or is not yet valid"

发现是因为提示证书过期 certificate has expired or is not yet valid

二、解决方法:

独立容器 Rancher Server 证书更新#

1. 证书未过期

证书未过期时,rancher server 可以正常运行。升级到 Rancher v2.0.14+ 、v2.1.9+、v2.2.2+ 后会自动检查证书有效期,如果发现证书即将过期,将会自动生成新的证书。所以独立容器运行的 Rancher Server,只需在证书过期前把 rancher 版本升级到支持自动更新 ssl 证书的版本即可,无需做其他操作。

2. 证书已过期

如果证书已过期,那么 rancher server 无法正常运行。即使升级到 Rancher v2.0.14+ 、v2.1.9+、v2.2.2+ 也可能会提示证书错误。如果出现这种情况,可通过以下操作进行处理:

正常升级 rancher 版本到 v2.0.14+ 、v2.1.9+、v2.2.2+;

执行以下命令:

  • 2.0 或 2.1 版本
docker exec -ti <rancher_server_id> mv /var/lib/rancher/management-state/certs/bundle.json /var/lib/rancher/management-state/certs/bundle.json-bak
  • 2.2 +
docker exec -ti <rancher_server_id> mv /var/lib/rancher/management-state/tls/localhost.crt /var/lib/rancher/management-state/tls/localhost.crt-bak
  • 2.3 +
docker exec -ti <rancher_server_id> mv /var/lib/rancher/k3s/server/tls /var/lib/rancher/k3s/server/tlsbak

执行两侧,第一次用于申请证书,第二次用于加载证书并启动

docker restart <rancher_server_id>
  • 2.4/2.5 +

exec 到 rancher server

kubectl --insecure-skip-tls-verify -n kube-system delete secrets k3s-serving
kubectl --insecure-skip-tls-verify delete secret serving-cert -n cattle-system
rm -f /var/lib/rancher/k3s/server/tls/dynamic-cert.json

重启 rancher-server

执行以下命令刷新参数

curl --insecure -sfL https://<server-url>/v3  # 请将 <server-url> 替换为 Rancher Server 的访问地址

重启 Rancher Server 容器

docker restart <rancher_server_id>

这篇关于rancher 证书过期网页进不去 问题解决的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/973226

相关文章

Kotlin Map映射转换问题小结

《KotlinMap映射转换问题小结》文章介绍了Kotlin集合转换的多种方法,包括map(一对一转换)、mapIndexed(带索引)、mapNotNull(过滤null)、mapKeys/map... 目录Kotlin 集合转换:map、mapIndexed、mapNotNull、mapKeys、map

nginx中端口无权限的问题解决

《nginx中端口无权限的问题解决》当Nginx日志报错bind()to80failed(13:Permissiondenied)时,这通常是由于权限不足导致Nginx无法绑定到80端口,下面就来... 目录一、问题原因分析二、解决方案1. 以 root 权限运行 Nginx(不推荐)2. 为 Nginx

解决1093 - You can‘t specify target table报错问题及原因分析

《解决1093-Youcan‘tspecifytargettable报错问题及原因分析》MySQL1093错误因UPDATE/DELETE语句的FROM子句直接引用目标表或嵌套子查询导致,... 目录报js错原因分析具体原因解决办法方法一:使用临时表方法二:使用JOIN方法三:使用EXISTS示例总结报错原

Windows环境下解决Matplotlib中文字体显示问题的详细教程

《Windows环境下解决Matplotlib中文字体显示问题的详细教程》本文详细介绍了在Windows下解决Matplotlib中文显示问题的方法,包括安装字体、更新缓存、配置文件设置及编码調整,并... 目录引言问题分析解决方案详解1. 检查系统已安装字体2. 手动添加中文字体(以SimHei为例)步骤

SpringSecurity整合redission序列化问题小结(最新整理)

《SpringSecurity整合redission序列化问题小结(最新整理)》文章详解SpringSecurity整合Redisson时的序列化问题,指出需排除官方Jackson依赖,通过自定义反序... 目录1. 前言2. Redission配置2.1 RedissonProperties2.2 Red

nginx 负载均衡配置及如何解决重复登录问题

《nginx负载均衡配置及如何解决重复登录问题》文章详解Nginx源码安装与Docker部署,介绍四层/七层代理区别及负载均衡策略,通过ip_hash解决重复登录问题,对nginx负载均衡配置及如何... 目录一:源码安装:1.配置编译参数2.编译3.编译安装 二,四层代理和七层代理区别1.二者混合使用举例

Java中读取YAML文件配置信息常见问题及解决方法

《Java中读取YAML文件配置信息常见问题及解决方法》:本文主要介绍Java中读取YAML文件配置信息常见问题及解决方法,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要... 目录1 使用Spring Boot的@ConfigurationProperties2. 使用@Valu

SQL Server配置管理器无法打开的四种解决方法

《SQLServer配置管理器无法打开的四种解决方法》本文总结了SQLServer配置管理器无法打开的四种解决方法,文中通过图文示例介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的... 目录方法一:桌面图标进入方法二:运行窗口进入检查版本号对照表php方法三:查找文件路径方法四:检查 S

怎样通过分析GC日志来定位Java进程的内存问题

《怎样通过分析GC日志来定位Java进程的内存问题》:本文主要介绍怎样通过分析GC日志来定位Java进程的内存问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、GC 日志基础配置1. 启用详细 GC 日志2. 不同收集器的日志格式二、关键指标与分析维度1.

Java 线程安全与 volatile与单例模式问题及解决方案

《Java线程安全与volatile与单例模式问题及解决方案》文章主要讲解线程安全问题的五个成因(调度随机、变量修改、非原子操作、内存可见性、指令重排序)及解决方案,强调使用volatile关键字... 目录什么是线程安全线程安全问题的产生与解决方案线程的调度是随机的多个线程对同一个变量进行修改线程的修改操