Skip to content

Instantly share code, notes, and snippets.

@everpeace
Last active August 23, 2018 16:22
Show Gist options
  • Save everpeace/3438a70b14cfd727b991541bceac5fcd to your computer and use it in GitHub Desktop.
Save everpeace/3438a70b14cfd727b991541bceac5fcd to your computer and use it in GitHub Desktop.
kube-scheduler's config file and policy config file (policy.cfg) (v1.11.1)
# This config scheme is based on Kubernetes v.1.11.1
# ref: https://github.com/kubernetes/kubernetes/blob/v1.11.1/pkg/apis/componentconfig/v1alpha1/types.go#L75-L112
# NOTE: You can dump default config yaml by this command:
# $ docker run -v $(pwd):/host gcr.io/google_containers/hyperkube-amd64:v1.11.1 kube-scheduler --write-config-to /host/config.yaml
# TypeMeta
apiVersion: componentconfig/v1alpha1
kind: KubeSchedulerConfiguration
# SchedulerName is name of the scheduler, used to select which pods
# will be processed by this scheduler, based on pod's "spec.SchedulerName".
schedulerName: default-scheduler
# AlgorithmSource specifies the scheduler algorithm source.
algorithmSource:
# 1. Provider: name based algrithm provider
# defined in https://github.com/kubernetes/kubernetes/blob/v1.11.1/pkg/scheduler/algorithmprovider/defaults/defaults.go#L215-L222
provider: DefaultProvider # or ClusterAutoscalerProvider
# # 2. Policy: Policy based algorithm provider source
# # - File: file based source
# policy:
# file:
# path: /path/to/policy-file
# # - ConfigMap: configMap based sourde
# policy:
# configMap:
# namespace: kube-system
# name: schduler-policy
# RequiredDuringScheduling affinity is not symmetric, but there is an implicit
# PreferredDuringScheduling affinity rule corresponding to every RequiredDuringScheduling
# affinity rule. HardPodAffinitySymmetricWeight represents the weight of implicit
# PreferredDuringScheduling affinity rule, in the range 0-100.
hardPodAffinitySymmetricWeight: 1
# LeaderElection defines the configuration of leader election client.
leaderElection:
leaderElect: true
leaseDuration: 15s
lockObjectName: kube-scheduler
lockObjectNamespace: kube-system
renewDeadline: 10s
resourceLock: endpoints
retryPeriod: 2s
# ClientConnection specifies the kubeconfig file and client connection
# settings for the proxy server to use when communicating with the apiserver.
clientConnection:
# kubeConfigFile is the path to a kubeconfig file. empty for using in cluster configs
kubeconfig: /path/to/kubeconfig
# default value of 'application/json'
acceptContentTypes: ""
burst: 100
contentType: application/vnd.kubernetes.protobuf
qps: 50
# HealthzBindAddress is the IP address and port for the health check server to serve on,
# defaulting to 0.0.0.0:10251
healthzBindAddress: 0.0.0.0:10251
# MetricsBindAddress is the IP address and port for the metrics server to
# serve on, defaulting to 0.0.0.0:10251.
metricsBindAddress: 0.0.0.0:10251
# EnableProfiling enables profiling via web interface on /debug/pprof
# handler. Profiling handlers will be handled by metrics server.
enableProfiling: false
# EnableContentionProfiling enables lock contention profiling, if
# EnableProfiling is true.
enableContentionProfiling: false
# Indicate the "all topologies" set for empty topologyKey when it's used for PreferredDuringScheduling pod anti-affinity.
failureDomains: kubernetes.io/hostname,failure-domain.beta.kubernetes.io/zone,failure-domain.beta.kubernetes.io/region
# DisablePreemption disables the pod preemption feature.
disablePreemption: false
#
# PLEASE DELETE COMMENTS WHEN YOU USE
#
# 'policy.cfg' MUST be json
# This schema is based on Kubernetes v1.11.1
# ref: https://github.com/kubernetes/kubernetes/blob/v1.11.1/pkg/scheduler/api/v1/types.go#L31-L50
{
# TypeMeta
"kind" : "Policy",
"apiVersion" : "v1",
# Holds the information to configure the fit predicate functions
# predicates list: https://github.com/kubernetes/kubernetes/blob/v1.11.1/pkg/scheduler/algorithm/predicates/predicates.go#L52-L94
"predicates" : [
{"name" : "PodFitsHostPorts"},
{"name" : "PodFitsResources"},
{"name" : "NoDiskConflict"},
{"name" : "MatchNodeSelector"},
{"name" : "HostName"}
],
# Holds the information to configure the priority functions
# priorities list: https://github.com/kubernetes/kubernetes/tree/v1.11.1/pkg/scheduler/algorithm/priorities
"priorities" : [
{"name" : "LeastRequestedPriority", "weight" : 1},
{"name" : "BalancedResourceAllocation", "weight" : 1},
{"name" : "ServiceSpreadingPriority", "weight" : 1},
{"name" : "EqualPriority", "weight" : 1}
],
# Holds the information to communicate with the extender(s)
"extenders" : [{
# URLPrefix at which the extender is available
"urlPrefix": "http://localhost/scheduler",
# Verb for the filter call, empty if not supported.
# This verb is appended to the URLPrefix when issuing the filter call to extender.
"filterVerb": "predicates/always_true",
# Verb for the preempt call, empty if not supported.
# This verb is appended to the URLPrefix when issuing the preempt call to extender.
"preemptVerb": "/preemption",
# Verb for the prioritize call, empty if not supported.
# This verb is appended to the URLPrefix when issuing the prioritize call to extender.
"prioritizeVerb": "priorities/zero_score",
# The numeric multiplier for the node scores that the prioritize call generates.
# The weight should be a positive integer
"weight": 1,
# Verb for the bind call, empty if not supported.
# This verb is appended to the URLPrefix when issuing the bind call to extender.
# If this method is implemented by the extender, it is the extender's responsibility
# to bind the pod to apiserver. Only one extender can implement this function.
"bindVerb": "",
# EnableHTTPS specifies whether https should be used to communicate with the extender
"enableHttps": false,
# TLSConfig specifies the transport layer security config
"tlsConfig": { ... }
# HTTPTimeout specifies the timeout duration for a call to the extender.
# Filter timeout fails the scheduling of the pod.
# Prioritize timeout is ignored, k8s/other extenders priorities are used to select the node.
"httpTimeout": "1000000000"
# NodeCacheCapable specifies that the extender is capable of caching node information,
# so the scheduler should only send minimal information about the eligible nodes
# assuming that the extender already cached full details of all nodes in the cluster
"nodeCacheCapable": false,
# ManagedResources is a list of extended resources that are managed by
# this extender.
# - A pod will be sent to the extender on the Filter, Prioritize and Bind
# (if the extender is the binder) phases iff the pod requests at least
# one of the extended resources in this list. If empty or unspecified,
# all pods will be sent to this extender.
# - If IgnoredByScheduler is set to true for a resource, kube-scheduler
# will skip checking the resource in predicates.
"managedResources": [{
# the extended resource name
"name": "extended-resource-name",
# indicates whether kube-scheduler should ignore this
# resource when applying predicates
"ignoredByScheduler": false
}],
# specifies if the extender is ignorable, i.e. scheduling should not
# fail when the extender returns an error or is not reachable.
"ignorable": false,
}],
# RequiredDuringScheduling affinity is not symmetric, but there is
# an implicit PreferredDuringScheduling affinity rule corresponding to
# every RequiredDuringScheduling affinity rule.
# HardPodAffinitySymmetricWeight represents the weight of implicit
# PreferredDuringScheduling affinity rule, in the range 1-100.
"hardPodAffinitySymmetricWeight" : 10,
# When AlwaysCheckAllPredicates is set to true, scheduler checks all
# the configured predicates even after one or more of them fails.
# When the flag is set to false, scheduler skips checking the rest
# of the predicates after it finds one predicate that failed.
"alwaysCheckAllPredicates": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment