cle*_*ent 1 bash kubernetes kubectl
我想循环遍历kubectl get nodes命令中的节点名称
并在Bash.
kubectl在-oflag下提供各种过滤器。您可以使用kubectl --help. 一种方法是使用 for 循环遍历它。
for node in $(kubectl get nodes -o name);
do
echo " Node Name: ${node##*/}"
echo "Type/Node Name: ${node}"
echo
done
Run Code Online (Sandbox Code Playgroud)
-o, --output='': 输出格式。其中之一:json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=。 ..|jsonpath-文件=...
| 归档时间: |
|
| 查看次数: |
323 次 |
| 最近记录: |