我想在包含在容器中的程序中运行命令kubectl port-forward。
代码如下:
````vba
Set lastRow = .Cells.Find("Location:", .Cells(1, 1), xlValues, xlPart, , xlPrevious)
Set firstRow = .Cells.Find("Call Date:", .Cells(1, 1), xlValues, xlPart, , xlPrevious)
For Each dateRange In ActiveSheet.Range("firstRow:lastRow") //not sure how to set and loop through each occurrence of first & last row
COUNTIF(firstRow:lastRow,":") //count the rows containing ":"
Next dateRange
现在,情况是: 我总是成功获取Pod列表(因此kubernetes和kubectl已正确配置)
尽管如此,但仍然很奇怪: 似乎它不理解第二个cli,一个要向前移植的cli,并用kubectl的可能命令列表来回答 然后,显示窗格列表(打印1),然后显示命令(打印2) 谢谢
答案 0 :(得分:0)
几乎应该肯定要使用Kubernetes API而不是尝试编写kubectl命令的脚本。您应该从不使用字符串格式化操作创建shell命令;几乎不可能保证这一点的安全性,在您描述的设置中,有动机的攻击者可以从群集中运行的任何服务中收集信息。
转到Kubernetes Python client github存储库以获取示例。