mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Introduced Metrics Server
This commit is contained in:
		
							
								
								
									
										12
									
								
								cluster/addons/metrics-server/auth-delegator.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								cluster/addons/metrics-server/auth-delegator.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					apiVersion: rbac.authorization.k8s.io/v1
 | 
				
			||||||
 | 
					kind: ClusterRoleBinding
 | 
				
			||||||
 | 
					metadata:
 | 
				
			||||||
 | 
					  name: metrics-server:system:auth-delegator
 | 
				
			||||||
 | 
					roleRef:
 | 
				
			||||||
 | 
					  apiGroup: rbac.authorization.k8s.io
 | 
				
			||||||
 | 
					  kind: ClusterRole
 | 
				
			||||||
 | 
					  name: system:auth-delegator
 | 
				
			||||||
 | 
					subjects:
 | 
				
			||||||
 | 
					- kind: ServiceAccount
 | 
				
			||||||
 | 
					  name: metrics-server
 | 
				
			||||||
 | 
					  namespace: kube-system
 | 
				
			||||||
							
								
								
									
										13
									
								
								cluster/addons/metrics-server/auth-reader.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								cluster/addons/metrics-server/auth-reader.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					apiVersion: rbac.authorization.k8s.io/v1
 | 
				
			||||||
 | 
					kind: RoleBinding
 | 
				
			||||||
 | 
					metadata:
 | 
				
			||||||
 | 
					  name: metrics-server-auth-reader
 | 
				
			||||||
 | 
					  namespace: kube-system
 | 
				
			||||||
 | 
					roleRef:
 | 
				
			||||||
 | 
					  apiGroup: rbac.authorization.k8s.io
 | 
				
			||||||
 | 
					  kind: Role
 | 
				
			||||||
 | 
					  name: extension-apiserver-authentication-reader
 | 
				
			||||||
 | 
					subjects:
 | 
				
			||||||
 | 
					- kind: ServiceAccount
 | 
				
			||||||
 | 
					  name: metrics-server
 | 
				
			||||||
 | 
					  namespace: kube-system
 | 
				
			||||||
							
								
								
									
										13
									
								
								cluster/addons/metrics-server/metrics-apiservice.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								cluster/addons/metrics-server/metrics-apiservice.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					apiVersion: apiregistration.k8s.io/v1beta1
 | 
				
			||||||
 | 
					kind: APIService
 | 
				
			||||||
 | 
					metadata:
 | 
				
			||||||
 | 
					  name: v1alpha1.metrics
 | 
				
			||||||
 | 
					spec:
 | 
				
			||||||
 | 
					  service:
 | 
				
			||||||
 | 
					    name: metrics-server
 | 
				
			||||||
 | 
					    namespace: kube-system
 | 
				
			||||||
 | 
					  group: metrics
 | 
				
			||||||
 | 
					  version: v1alpha1
 | 
				
			||||||
 | 
					  insecureSkipTLSVerify: true
 | 
				
			||||||
 | 
					  groupPriorityMinimum: 100
 | 
				
			||||||
 | 
					  versionPriority: 100
 | 
				
			||||||
							
								
								
									
										42
									
								
								cluster/addons/metrics-server/metrics-server-deployment.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								cluster/addons/metrics-server/metrics-server-deployment.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
				
			|||||||
 | 
					apiVersion: v1
 | 
				
			||||||
 | 
					kind: ServiceAccount
 | 
				
			||||||
 | 
					metadata:
 | 
				
			||||||
 | 
					  name: metrics-server
 | 
				
			||||||
 | 
					  namespace: kube-system
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					apiVersion: extensions/v1beta1
 | 
				
			||||||
 | 
					kind: Deployment
 | 
				
			||||||
 | 
					metadata:
 | 
				
			||||||
 | 
					  name: metrics-server
 | 
				
			||||||
 | 
					  namespace: kube-system
 | 
				
			||||||
 | 
					  labels:
 | 
				
			||||||
 | 
					    k8s-app: metrics-server
 | 
				
			||||||
 | 
					spec:
 | 
				
			||||||
 | 
					  selector:
 | 
				
			||||||
 | 
					    matchLabels:
 | 
				
			||||||
 | 
					      k8s-app: metrics-server
 | 
				
			||||||
 | 
					  template:
 | 
				
			||||||
 | 
					    metadata:
 | 
				
			||||||
 | 
					      name: metrics-server
 | 
				
			||||||
 | 
					      labels:
 | 
				
			||||||
 | 
					        k8s-app: metrics-server
 | 
				
			||||||
 | 
					    spec:
 | 
				
			||||||
 | 
					      serviceAccountName: metrics-server
 | 
				
			||||||
 | 
					      containers:
 | 
				
			||||||
 | 
					      - name: metrics-server
 | 
				
			||||||
 | 
					        image: gcr.io/google_containers/metrics-server-amd64:dev
 | 
				
			||||||
 | 
					        imagePullPolicy: Always
 | 
				
			||||||
 | 
					        # TODO(piosz): revisit resources
 | 
				
			||||||
 | 
					        resources:
 | 
				
			||||||
 | 
					          requests:
 | 
				
			||||||
 | 
					            memory: 100Mi
 | 
				
			||||||
 | 
					        command:
 | 
				
			||||||
 | 
					        - /metrics-server
 | 
				
			||||||
 | 
					        - --source=kubernetes.summary_api:''
 | 
				
			||||||
 | 
					        ports:
 | 
				
			||||||
 | 
					        - containerPort: 443
 | 
				
			||||||
 | 
					          name: https
 | 
				
			||||||
 | 
					          protocol: TCP
 | 
				
			||||||
 | 
					      tolerations:
 | 
				
			||||||
 | 
					        - key: "CriticalAddonsOnly"
 | 
				
			||||||
 | 
					          operator: "Exists"
 | 
				
			||||||
							
								
								
									
										14
									
								
								cluster/addons/metrics-server/metrics-server-service.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								cluster/addons/metrics-server/metrics-server-service.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					apiVersion: v1
 | 
				
			||||||
 | 
					kind: Service
 | 
				
			||||||
 | 
					metadata:
 | 
				
			||||||
 | 
					  name: metrics-server
 | 
				
			||||||
 | 
					  namespace: kube-system
 | 
				
			||||||
 | 
					  labels:
 | 
				
			||||||
 | 
					    kubernetes.io/name: "Metrics-server"
 | 
				
			||||||
 | 
					spec:
 | 
				
			||||||
 | 
					  selector:
 | 
				
			||||||
 | 
					    k8s-app: metrics-server
 | 
				
			||||||
 | 
					  ports:
 | 
				
			||||||
 | 
					  - port: 443
 | 
				
			||||||
 | 
					    protocol: TCP
 | 
				
			||||||
 | 
					    targetPort: https
 | 
				
			||||||
@@ -619,6 +619,7 @@ SERVICE_CLUSTER_IP_RANGE: $(yaml-quote ${SERVICE_CLUSTER_IP_RANGE})
 | 
				
			|||||||
KUBERNETES_MASTER_NAME: $(yaml-quote ${KUBERNETES_MASTER_NAME})
 | 
					KUBERNETES_MASTER_NAME: $(yaml-quote ${KUBERNETES_MASTER_NAME})
 | 
				
			||||||
ALLOCATE_NODE_CIDRS: $(yaml-quote ${ALLOCATE_NODE_CIDRS:-false})
 | 
					ALLOCATE_NODE_CIDRS: $(yaml-quote ${ALLOCATE_NODE_CIDRS:-false})
 | 
				
			||||||
ENABLE_CLUSTER_MONITORING: $(yaml-quote ${ENABLE_CLUSTER_MONITORING:-none})
 | 
					ENABLE_CLUSTER_MONITORING: $(yaml-quote ${ENABLE_CLUSTER_MONITORING:-none})
 | 
				
			||||||
 | 
					ENABLE_METRICS_SERVER: $(yaml-quote ${ENABLE_METRICS_SERVER:-false})
 | 
				
			||||||
DOCKER_REGISTRY_MIRROR_URL: $(yaml-quote ${DOCKER_REGISTRY_MIRROR_URL:-})
 | 
					DOCKER_REGISTRY_MIRROR_URL: $(yaml-quote ${DOCKER_REGISTRY_MIRROR_URL:-})
 | 
				
			||||||
ENABLE_L7_LOADBALANCING: $(yaml-quote ${ENABLE_L7_LOADBALANCING:-none})
 | 
					ENABLE_L7_LOADBALANCING: $(yaml-quote ${ENABLE_L7_LOADBALANCING:-none})
 | 
				
			||||||
ENABLE_CLUSTER_LOGGING: $(yaml-quote ${ENABLE_CLUSTER_LOGGING:-false})
 | 
					ENABLE_CLUSTER_LOGGING: $(yaml-quote ${ENABLE_CLUSTER_LOGGING:-false})
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -123,6 +123,12 @@ ENABLE_L7_LOADBALANCING="${KUBE_ENABLE_L7_LOADBALANCING:-glbc}"
 | 
				
			|||||||
#   standalone     - Heapster only. Metrics available via Heapster REST API.
 | 
					#   standalone     - Heapster only. Metrics available via Heapster REST API.
 | 
				
			||||||
ENABLE_CLUSTER_MONITORING="${KUBE_ENABLE_CLUSTER_MONITORING:-influxdb}"
 | 
					ENABLE_CLUSTER_MONITORING="${KUBE_ENABLE_CLUSTER_MONITORING:-influxdb}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Optional: Enable Metrics Server. Metrics Server should be enable everywhere,
 | 
				
			||||||
 | 
					# since it's a critical component, but in the first release we need a way to disable
 | 
				
			||||||
 | 
					# this in case of stability issues.
 | 
				
			||||||
 | 
					# TODO(piosz) remove this option once Metrics Server became a stable thing.
 | 
				
			||||||
 | 
					ENABLE_METRICS_SERVER="${KUBE_ENABLE_METRICS_SERVER:-true}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# One special node out of NUM_NODES would be created of this type if specified.
 | 
					# One special node out of NUM_NODES would be created of this type if specified.
 | 
				
			||||||
# Useful for scheduling heapster in large clusters with nodes of small size.
 | 
					# Useful for scheduling heapster in large clusters with nodes of small size.
 | 
				
			||||||
HEAPSTER_MACHINE_TYPE="${HEAPSTER_MACHINE_TYPE:-}"
 | 
					HEAPSTER_MACHINE_TYPE="${HEAPSTER_MACHINE_TYPE:-}"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -134,6 +134,12 @@ ENABLE_L7_LOADBALANCING="${KUBE_ENABLE_L7_LOADBALANCING:-glbc}"
 | 
				
			|||||||
#   standalone     - Heapster only. Metrics available via Heapster REST API.
 | 
					#   standalone     - Heapster only. Metrics available via Heapster REST API.
 | 
				
			||||||
ENABLE_CLUSTER_MONITORING="${KUBE_ENABLE_CLUSTER_MONITORING:-influxdb}"
 | 
					ENABLE_CLUSTER_MONITORING="${KUBE_ENABLE_CLUSTER_MONITORING:-influxdb}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Optional: Enable Metrics Server. Metrics Server should be enable everywhere,
 | 
				
			||||||
 | 
					# since it's a critical component, but in the first release we need a way to disable
 | 
				
			||||||
 | 
					# this in case of stability issues.
 | 
				
			||||||
 | 
					# TODO(piosz) remove this option once Metrics Server became a stable thing.
 | 
				
			||||||
 | 
					ENABLE_METRICS_SERVER="${KUBE_ENABLE_METRICS_SERVER:-true}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# One special node out of NUM_NODES would be created of this type if specified.
 | 
					# One special node out of NUM_NODES would be created of this type if specified.
 | 
				
			||||||
# Useful for scheduling heapster in large clusters with nodes of small size.
 | 
					# Useful for scheduling heapster in large clusters with nodes of small size.
 | 
				
			||||||
HEAPSTER_MACHINE_TYPE="${HEAPSTER_MACHINE_TYPE:-}"
 | 
					HEAPSTER_MACHINE_TYPE="${HEAPSTER_MACHINE_TYPE:-}"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -420,6 +420,7 @@ enable_node_problem_detector: '$(echo "$ENABLE_NODE_PROBLEM_DETECTOR" | sed -e "
 | 
				
			|||||||
enable_l7_loadbalancing: '$(echo "$ENABLE_L7_LOADBALANCING" | sed -e "s/'/''/g")'
 | 
					enable_l7_loadbalancing: '$(echo "$ENABLE_L7_LOADBALANCING" | sed -e "s/'/''/g")'
 | 
				
			||||||
enable_node_logging: '$(echo "$ENABLE_NODE_LOGGING" | sed -e "s/'/''/g")'
 | 
					enable_node_logging: '$(echo "$ENABLE_NODE_LOGGING" | sed -e "s/'/''/g")'
 | 
				
			||||||
enable_metadata_proxy: '$(echo "$ENABLE_METADATA_PROXY" | sed -e "s/'/''/g")'
 | 
					enable_metadata_proxy: '$(echo "$ENABLE_METADATA_PROXY" | sed -e "s/'/''/g")'
 | 
				
			||||||
 | 
					enable_metrics_server: '$(echo "$ENABLE_METRICS_SERVER" | sed -e "s/'/''/g")'
 | 
				
			||||||
enable_rescheduler: '$(echo "$ENABLE_RESCHEDULER" | sed -e "s/'/''/g")'
 | 
					enable_rescheduler: '$(echo "$ENABLE_RESCHEDULER" | sed -e "s/'/''/g")'
 | 
				
			||||||
logging_destination: '$(echo "$LOGGING_DESTINATION" | sed -e "s/'/''/g")'
 | 
					logging_destination: '$(echo "$LOGGING_DESTINATION" | sed -e "s/'/''/g")'
 | 
				
			||||||
elasticsearch_replicas: '$(echo "$ELASTICSEARCH_LOGGING_REPLICAS" | sed -e "s/'/''/g")'
 | 
					elasticsearch_replicas: '$(echo "$ELASTICSEARCH_LOGGING_REPLICAS" | sed -e "s/'/''/g")'
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1312,6 +1312,9 @@ function start-kube-addons {
 | 
				
			|||||||
    sed -i -e "s@{{ *metrics_cpu_per_node *}}@${metrics_cpu_per_node}@g" "${controller_yaml}"
 | 
					    sed -i -e "s@{{ *metrics_cpu_per_node *}}@${metrics_cpu_per_node}@g" "${controller_yaml}"
 | 
				
			||||||
    update-prometheus-to-sd-parameters ${controller_yaml}
 | 
					    update-prometheus-to-sd-parameters ${controller_yaml}
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					  if [[ "${ENABLE_METRICS_SERVER:-}" == "true" ]]; then
 | 
				
			||||||
 | 
					    setup-addon-manifests "addons" "metrics-server"
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
  if [[ "${ENABLE_CLUSTER_DNS:-}" == "true" ]]; then
 | 
					  if [[ "${ENABLE_CLUSTER_DNS:-}" == "true" ]]; then
 | 
				
			||||||
    setup-addon-manifests "addons" "dns"
 | 
					    setup-addon-manifests "addons" "dns"
 | 
				
			||||||
    local -r dns_controller_file="${dst_dir}/dns/kubedns-controller.yaml"
 | 
					    local -r dns_controller_file="${dst_dir}/dns/kubedns-controller.yaml"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1740,6 +1740,9 @@ function start-kube-addons {
 | 
				
			|||||||
    sed -i -e "s@{{ *metrics_cpu_per_node *}}@${metrics_cpu_per_node}@g" "${controller_yaml}"
 | 
					    sed -i -e "s@{{ *metrics_cpu_per_node *}}@${metrics_cpu_per_node}@g" "${controller_yaml}"
 | 
				
			||||||
    update-prometheus-to-sd-parameters ${controller_yaml}
 | 
					    update-prometheus-to-sd-parameters ${controller_yaml}
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					  if [[ "${ENABLE_METRICS_SERVER:-}" == "true" ]]; then
 | 
				
			||||||
 | 
					    setup-addon-manifests "addons" "metrics-server"
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
  if [[ "${ENABLE_CLUSTER_DNS:-}" == "true" ]]; then
 | 
					  if [[ "${ENABLE_CLUSTER_DNS:-}" == "true" ]]; then
 | 
				
			||||||
    setup-addon-manifests "addons" "dns"
 | 
					    setup-addon-manifests "addons" "dns"
 | 
				
			||||||
    local -r dns_controller_file="${dst_dir}/dns/kubedns-controller.yaml"
 | 
					    local -r dns_controller_file="${dst_dir}/dns/kubedns-controller.yaml"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user