2.11. 修改节点
在安装过程中,OpenShift Container Platform 为每类节点组在 openshift-node 项目中创建一个 configmap:
- node-config-master
- node-config-infra
- node-config-compute
- node-config-all-in-one
- node-config-master-infra
若要对现有节点进行配置更改,请编辑相应的配置映射。各个节点上的 同步 pod 监视配置映射的变化。在安装过程中,使用 sync Daemonsets 和一个 /etc/origin/node/node-config.yaml 文件(节点的配置参数所在的文件)创建的同步 pod 被添加到每个节点。当同步 pod 检测到配置映射更改时,它会在该节点组的所有节点上更新 node-config.yaml,并在适当的节点上重启 atomic-openshift-node.service。
$ oc get cm -n openshift-node
输出示例
NAME DATA AGE
node-config-all-in-one 1 1d
node-config-compute 1 1d
node-config-infra 1 1d
node-config-master 1 1d
node-config-master-infra 1 1d
node-config-compute 组的配置映射示例
apiVersion: v1
authConfig:
authenticationCacheSize: 1000
authenticationCacheTTL: 5m
authorizationCacheSize: 1000
authorizationCacheTTL: 5m
dnsBindAddress: 127.0.0.1:53
dnsDomain: cluster.local
dnsIP: 0.0.0.0
dnsNameservers: null
dnsRecursiveResolvConf: /etc/origin/node/resolv.conf
dockerConfig:
dockerShimRootDirectory: /var/lib/dockershim
dockerShimSocket: /var/run/dockershim.sock
execHandlerName: native
enableUnidling: true
imageConfig:
format: registry.reg-aws.openshift.com/openshift3/ose-${component}:${version}
latest: false
iptablesSyncPeriod: 30s
kind: NodeConfig
kubeletArguments:
bootstrap-kubeconfig:
- /etc/origin/node/bootstrap.kubeconfig
cert-dir:
- /etc/origin/node/certificates
cloud-config:
- /etc/origin/cloudprovider/aws.conf
cloud-provider:
- aws
enable-controller-attach-detach:
- 'true'
feature-gates:
- RotateKubeletClientCertificate=true,RotateKubeletServerCertificate=true
node-labels:
- node-role.kubernetes.io/compute=true
pod-manifest-path:
- /etc/origin/node/pods
rotate-certificates:
- 'true'
masterClientConnectionOverrides:
acceptContentTypes: application/vnd.kubernetes.protobuf,application/json
burst: 40
contentType: application/vnd.kubernetes.protobuf
qps: 20
masterKubeConfig: node.kubeconfig
networkConfig:
mtu: 8951
networkPluginName: redhat/openshift-ovs-subnet
servingInfo:
bindAddress: 0.0.0.0:10250
bindNetwork: tcp4
clientCA: client-ca.crt
volumeConfig:
localQuota:
perFSGroup: null
volumeDirectory: /var/lib/origin/openshift.local.volumes
- 1
- 身份验证和授权配置选项.
- 2
- 附加到 pod 的 /etc/resolv.conf 的 IP 地址。
- 3
- 直接传递给与 Kubelet 命令行参数匹配的 Kubelet 的键值对。
- 4
- pod 清单文件或目录的路径。目录必须包含一个或多个清单文件。OpenShift 容器平台使用清单文件在节点上创建 pod。
- 5
- 节点上的 pod 网络设置。
- 6
- 软件定义型网络(SDN)插件.为 ovs-subnet 插件设置为
redhat/openshift-ovs-subnet,为 ovs-multitenant 插件设置为redhat/openshift-ovs-multitenant,为 ovs-networkpolicy 插件设置为redhat/openshift-ovs-networkpolicy。 - 7
- 节点的证书信息。
- 8
- 可选:PEM 编码的证书捆绑包。如果设置,则必须根据指定文件中的证书颁发机构显示并验证有效的客户端证书,然后才能检查请求标头中的用户名。
注意
不要手动修改 /etc/origin/node/node-config.yaml 文件。
2.11.1. 配置节点资源 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
您可以通过在节点配置映射中添加 kubelet 参数来配置节点资源。
编辑配置映射:
$ oc edit cm node-config-compute -n openshift-node添加
kubeletArguments部分并指定您的选项:kubeletArguments: max-pods:1 - "40" resolv-conf:2 - "/etc/resolv.conf" image-gc-high-threshold:3 - "90" image-gc-low-threshold:4 - "80" kube-api-qps:5 - "20" kube-api-burst:6 - "40"查看所有可用 kubelet 选项:
$ hyperkube kubelet -h