12. Rancher Kubernetes 组件-过期 Webhook 证书轮换故障排除

Rancher Kubernetes 组件图

过期 Webhook 证书轮换

如果你的 Rancher 版本安装了 rancher-webhook,某些版本创建的证书将在一年后过期。如果证书未续订,你需要轮换你的 webhook 证书。

在 Rancher v2.6.3 及更高版本中,rancher-webhook deployments 将在到期日期后 30 天或更短的时间内自动更新其 TLS 证书。如果你使用的是 v2.6.2 或更低版本,你可以通过下面两种方法来解决这个问题。

1. 如果用户具有集群访问权限,运行以下命令:
kubectl delete secret -n cattle-system cattle-webhook-tls
kubectl delete mutatingwebhookconfigurations.admissionregistration.k8s.io --ignore-not-found=true rancher.cattle.io
kubectl delete pod -n cattle-system -l app=rancher-webhook

2. 如果用户没有集群访问权限,使用 kubectl
  1. 删除 local 集群 cattle-system 命名空间中的 cattle-webhook-tls 密文。

  2. 删除 rancher.cattle.io mutating webhook。

  3. 删除 local 集群 cattle-system 命名空间中的 rancher-webhook pod。

备注

webhook 证书过期问题不止示例中列出的 cattle-webhook-tls。你需要相应地填写你过期的证书密文。

IT干货+136-6258-1235-CSDN博客

  • 8
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
以下是一个示例的 `Dockerfile` 和 `.rancher-pipeline.yml` 文件,用于将 Python 应用程序打包成 API 并在 Rancher 上部署: Dockerfile: ``` FROM python:3.8-slim-buster # Set the working directory WORKDIR /app # Install dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the application code COPY app.py . # Expose the port EXPOSE 5000 # Start the application CMD [ "python", "app.py" ] ``` .rancher-pipeline.yml: ``` version: 2 # Define the pipeline pipelines: default: # Define the build step build: # Use the Dockerfile to build the image image: dockerfile:1.1.1 dockerfilePath: Dockerfile # Push the image to the Docker registry push: true registry: <your-registry> repository: <your-repository> tag: latest # Define the deploy step deploy: # Use the Rancher provider to deploy the image provider: rancher2 # Specify the Rancher API URL and access key apiURL: https://<your-rancher-url>/v3 accessKey: <your-access-key> secretKey: <your-secret-key> # Specify the Rancher project and namespace projectID: <your-project-id> namespace: <your-namespace> # Specify the Docker image to deploy image: <your-registry>/<your-repository>:latest # Specify the number of replicas to run replicas: 1 # Specify the service name and port serviceName: <your-service-name> servicePort: 5000 ``` 要使用这些文件,请按照以下步骤进行操作: 1. 创建一个名为 `Dockerfile` 的文件,并将上述 Dockerfile 代码复制到其中。 2. 创建一个名为 `requirements.txt` 的文件,并将 Python 应用程序的依赖项列在其中。 3. 创建一个名为 `app.py` 的文件,并将 Python 应用程序的代码复制到其中。 4. 创建一个名为 `.rancher-pipeline.yml` 的文件,并将上述 .rancher-pipeline.yml 代码复制到其中。 5. 将 `<your-registry>`、`<your-repository>`、`<your-rancher-url>`、`<your-access-key>`、`<your-secret-key>`、`<your-project-id>`、`<your-namespace>` 和 `<your-service-name>` 替换为实际值。 6. 将这些文件添加到 Git 存储库中,并在 Rancher 上设置 CI/CD 管道以使用这些文件构建和部署应用程序。 注意:这些文件只是示例,并且可能需要根据您的实际需求进行修改。请参考 Rancher 和 Docker 文档以了解有关如何使用这些工具的更多信息。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

IT干货+136-6258-1235

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值