From 33b74a61a74b08f81af9e906169c936218d4f2a8 Mon Sep 17 00:00:00 2001 From: "yanrong.shi" Date: Wed, 13 Jul 2022 22:26:53 +0800 Subject: [PATCH] Update cheatsheet.md --- content/zh-cn/docs/reference/kubectl/cheatsheet.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/content/zh-cn/docs/reference/kubectl/cheatsheet.md b/content/zh-cn/docs/reference/kubectl/cheatsheet.md index 8878d01f7f..f85846aa32 100644 --- a/content/zh-cn/docs/reference/kubectl/cheatsheet.md +++ b/content/zh-cn/docs/reference/kubectl/cheatsheet.md @@ -334,6 +334,9 @@ kubectl get pods --selector=app=cassandra -o \ kubectl get configmap myconfig \ -o jsonpath='{.data.ca\.crt}' +# Retrieve a base64 encoded value with dashes instead of underscores. +kubectl get secret my-secret --template='{{index .data "key-name-with-dashes"}}' + # Get all worker nodes (use a selector to exclude results that have a label # named 'node-role.kubernetes.io/control-plane') kubectl get node --selector='!node-role.kubernetes.io/control-plane' @@ -417,6 +420,9 @@ kubectl get pods --selector=app=cassandra -o \ kubectl get configmap myconfig \ -o jsonpath='{.data.ca\.crt}' +# 检索一个 base64 编码的值,其中的键名应该包含减号而不是下划线。 +kubectl get secret my-secret --template='{{index .data "key-name-with-dashes"}}' + # 获取所有工作节点(使用选择器以排除标签名称为 'node-role.kubernetes.io/control-plane' 的结果) kubectl get node --selector='!node-role.kubernetes.io/control-plane'