我正在尝试为垃圾收集添加kublet参数,以使其自动处理。我按照以下步骤操作,并且在编辑节点时在io.k8s.api.core.v1.NodeConfigSource 中将错误显示为“ 未知字段” configMap”
步骤1:
bash kubectl proxy --port=8001 &
步骤2: 拉出当前的配置文件
NODE_NAME="the-name-of-the-node-you-are-reconfiguring"; curl -sSL "http://localhost:8001/api/v1/nodes/${NODE_NAME}/proxy/configz" | jq '.kubeletconfig|.kind="KubeletConfiguration"|.apiVersion="kubelet.config.k8s.io/v1beta1"' > kubelet_configz_${NODE_NAME}
步骤3: 我编辑了这些值
"imageGCHighThresholdPercent": 70,
"imageGCLowThresholdPercent": 65,
第4步: 将配置推送到控制平面
kubectl -n kube-system create configmap my-node-config --from-file=kubelet=kubelet_configz_${NODE_NAME} --append-hash -o yaml
第5步: 编辑节点
kubectl edit node ${NODE_NAME}
在其中添加了配置源
configSource:
configMap:
name: CONFIG_MAP_NAME #my new created configmap name added
namespace: kube-system
kubeletConfigKey: kubelet
在io.k8s.api.core.v1.NodeConfigSource中将编辑节点获取错误保存为“未知字段“ configMap”时
我的节点信息
nodeInfo:
architecture: amd64
bootID: 951c736d-9a2c-4a81-bf32-922c53970ab3
containerRuntimeVersion: docker://17.3.2
kernelVersion: 3.10.0-693.11.6.el7.x86_64
kubeProxyVersion: v1.10.6
kubeletVersion: v1.10.6
machineID: 609bbd29e32a4898e604f49bff82a88c
operatingSystem: linux
osImage: CentOS Linux 7 (Core)
systemUUID: EC20197C-6279-B13C-6A3A-000FDAC5C4E8
apiVersion: v1
items:
- apiVersion: v1
kind: Node
metadata:
annotations:
node.alpha.kubernetes.io/ttl: "0"
volumes.kubernetes.io/controller-managed-attach-detach: "true"
规格信息:
spec:
externalID: i-0f84faccd78dff3b3
podCIDR: 109.92.5.0/24
providerID: aws:///ap-south-1a/i-0foh4faccdsdcns3b3
引用链接:https://kubernetes.io/docs/tasks/administer-cluster/reconfigure-kubelet/
答案 0 :(得分:0)
configSource:
configMap:
name: CONFIG_MAP_NAME
namespace: kube-system
kubeletConfigKey: kubelet
尝试一次