【问题标题】:Run a PowerShell script on Azure AKS nodes,在 Azure AKS 节点上运行 PowerShell 脚本,
【发布时间】:2021-10-26 15:49:25
【问题描述】:

我有一个 PowerShell 脚本,我想在某些 Azure AKS 节点(运行 Windows)上运行它来部署安全工具。软件供应商没有为此设置守护程序。我将如何完成它?

感谢一百万 阿卜杜勒

【问题讨论】:

  • 安全工具是什么意思?您可能必须编写自己的守护进程规范或与供应商合作。
  • 一个名为 Prisma cloud 的安全工具。他们说 Windows 平台没有守护程序集,而仅适用于 Linux。他们给了我们一个 poweshell 脚本来运行它来在这些 windows 节点上创建 docker 容器,但是我如何在 kubernetes windows 节点上运行这个脚本。这就是我的窍门。
  • 您可以创建一个基础 Docker 映像,在部署应用程序之前运行脚本?还是在每个节点上运行?

标签: windows azure powershell kubernetes azure-aks


【解决方案1】:

here 提出了类似的问题。用户philipwelz 写道:

嘿,

虽然有办法做到这一点,但我建议你不要这样做。原因是您的 AKS 设置不应允许直接在 AKS 节点上执行容器内的脚本。这将意味着 IMO 存在巨大的安全问题。

我建议找到一种直接在节点上执行脚本的方式,例如使用 PowerShell 远程处理或任何适合您的方式。

BR,
菲利普

这个用户是对的。您应该避免在 AKS 节点上执行脚本。在您的情况下,如果您想部署 Prisma 云,您需要使用 following doc。你说得对,安装脚本只能在 Linux 上运行:

安装脚本仅适用于 Linux 主机。

但是,对于 Windows 和 Mac 软件,您有特定的 yaml 文件:

对于 macOS 和 Windows 主机,使用 twistcli 生成 Defender DaemonSet YAML 配置文件,然后使用 kubectl 部署它,如下所述。

整个过程在我引用的文档中有详细描述。注意第3步和第4步。可以看到,不需要运行任何powershell脚本:

第 3 步:

   The following command connects to Console (specified in  [--address](https://docs.paloaltonetworks.com/prisma/prisma-cloud/prisma-cloud-admin-compute/install/install_kubernetes.html#)) as user <ADMIN> (specified in  [--user](https://docs.paloaltonetworks.com/prisma/prisma-cloud/prisma-cloud-admin-compute/install/install_kubernetes.html#)), and generates a Defender DaemonSet YAML config file according to the configuration options passed to  [twistcli](https://docs.paloaltonetworks.com/prisma/prisma-cloud/prisma-cloud-admin-compute/install/install_kubernetes.html#). The  [--cluster-address](https://docs.paloaltonetworks.com/prisma/prisma-cloud/prisma-cloud-admin-compute/install/install_kubernetes.html#)  option specifies the address Defender uses to connect to Console.
   
   $ <PLATFORM>/twistcli defender export kubernetes \
     --user <ADMIN_USER> \
     --address <PRISMA_CLOUD_COMPUTE_CONSOLE_URL> \
     --cluster-address <PRISMA_CLOUD_COMPUTE_HOSTNAME>
   
   -   <PLATFORM> can be linux, osx, or windows.
       
   -   <ADMIN_USER> is the name of a Prisma Cloud user with the System Admin role.

然后是第 4 步:

kubectl create -f ./defender.yaml

【讨论】:

    猜你喜欢
    • 2022-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-25
    • 2019-05-05
    • 1970-01-01
    相关资源
    最近更新 更多