11. Rancher Kubernetes 组件-审计日志故障排除

Rancher Kubernetes 组件图

审计日志中的用户 ID 跟踪

Rancher 使用以下审计日志来跟踪本地和下游集群中发生的事件:

Rancher 2.6 增强了审计日志,在 Rancher 和下游 Kubernetes 审计日志中都包含了外部身份提供程序名称(即外部身份提供程序中用户的通用名称)。

在 Rancher 2.6 之前,如果管理员不知道外部身份提供程序中的用户名和 Rancher 中的 userId (u-xXXX) 之间的映射,则无法通过 Rancher 审计日志和 Kubernetes 审计日志来追踪事件。 要知道这个映射,集群管理员需要能够访问 Rancher API、UI 和 local 管理集群。

有了这个功能之后,下游集群管理员就能够查看 Kubernetes 审计日志,并且可以不在 Rancher 中查看任何内容就能知道哪个外部身份提供程序 (IDP) 用户执行了某项操作。 如果集群传出了审计日志,日志系统的用户就能够识别外部身份提供程序中的用户。 Rancher 管理员现在能够查看 Rancher 审计日志,并使用外部身份提供程序用户名来跟踪 Kubernetes 审计日志。

功能描述

  • 在下游集群启用了 Kubernetes 审计日志后,会在“元数据”级别为每个请求记录外部身份提供程序的用户名。
  • 在 Rancher 启用 Rancher API 审计日志后,每个到达 Rancher API Server 的请求记录(包括登录请求)对应的外部身份提供程序用户名也会记录在 auditLog.level=1 中。

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

  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 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、付费专栏及课程。

余额充值