集群中节点的云服务信息将不再能够从本地元数据中获取,取而代之的是所有获取节点信息的 API 调用都将通过云管理控制器。这意味着你可以通过限制到 kubelet 云服务 API 的访问来提升安全性。在更大的集群中您可能需要考虑云管理控制器是否会遇到速率限制,因为它现在负责集群中几乎所有到云服务的 API 调用。
对于 v1.8 版本,云管理控制器可以实现:
node 控制器 - 负责使用云服务 API 更新 kubernetes 节点并删除在云服务上已经删除的 kubernetes 节点。
service 控制器 - 负责在云服务上为类型为 LoadBalancer 的 service 提供负载均衡器。
# This is an example of how to setup cloud-controller-manger as a Daemonset in your cluster.# It assumes that your masters can run pods and has the role node-role.kubernetes.io/master# Note that this Daemonset will not work straight out of the box for your cloud, this is# meant to be a guideline.---apiVersion:v1kind:ServiceAccountmetadata:name:cloud-controller-managernamespace:kube-system---apiVersion:rbac.authorization.k8s.io/v1kind:ClusterRoleBindingmetadata:name:system:cloud-controller-managerroleRef:apiGroup:rbac.authorization.k8s.iokind:ClusterRolename:cluster-adminsubjects:-kind:ServiceAccountname:cloud-controller-managernamespace:kube-system---apiVersion:apps/v1kind:DaemonSetmetadata:labels:k8s-app:cloud-controller-managername:cloud-controller-managernamespace:kube-systemspec:selector:matchLabels:k8s-app:cloud-controller-managertemplate:metadata:labels:k8s-app:cloud-controller-managerspec:serviceAccountName:cloud-controller-managercontainers:-name:cloud-controller-manager# for in-tree providers we use k8s.gcr.io/cloud-controller-manager# this can be replaced with any other image for out-of-tree providersimage:k8s.gcr.io/cloud-controller-manager:v1.8.0command:-/usr/local/bin/cloud-controller-manager---cloud-provider=[YOUR_CLOUD_PROVIDER]# Add your own cloud provider here!---leader-elect=true---use-service-account-credentials# these flags will vary for every cloud provider---allocate-node-cidrs=true---configure-cloud-routes=true---cluster-cidr=172.17.0.0/16tolerations:# this is required so CCM can bootstrap itself-key:node.cloudprovider.kubernetes.io/uninitializedvalue:"true"effect:NoSchedule# this is to have the daemonset runnable on master nodes# the taint may vary depending on your cluster setup-key:node-role.kubernetes.io/mastereffect:NoSchedule# this is to restrict CCM to only run on master nodes# the node selector may vary depending on your cluster setupnodeSelector:node-role.kubernetes.io/master:""