config-default.sh 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #!/bin/bash
  2. # Copyright 2014 The Kubernetes Authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ## Contains configuration values for interacting with the Vagrant cluster
  16. # Number of nodes in the cluster
  17. NUM_NODES=${NUM_NODES-"1"}
  18. export NUM_NODES
  19. # The IP of the master
  20. export MASTER_IP=${MASTER_IP-"10.245.1.2"}
  21. export KUBE_MASTER_IP=${MASTER_IP}
  22. export INSTANCE_PREFIX="kubernetes"
  23. export MASTER_NAME="${INSTANCE_PREFIX}-master"
  24. # Should the master serve as a node
  25. REGISTER_MASTER_KUBELET=${REGISTER_MASTER:-false}
  26. # Map out the IPs, names and container subnets of each node
  27. export NODE_IP_BASE=${NODE_IP_BASE-"10.245.1."}
  28. NODE_CONTAINER_SUBNET_BASE="10.246"
  29. MASTER_CONTAINER_NETMASK="255.255.255.0"
  30. MASTER_CONTAINER_ADDR="${NODE_CONTAINER_SUBNET_BASE}.0.1"
  31. MASTER_CONTAINER_SUBNET="${NODE_CONTAINER_SUBNET_BASE}.0.1/24"
  32. CONTAINER_SUBNET="${NODE_CONTAINER_SUBNET_BASE}.0.0/16"
  33. for ((i=0; i < NUM_NODES; i++)) do
  34. NODE_IPS[$i]="${NODE_IP_BASE}$((i+3))"
  35. NODE_NAMES[$i]="${INSTANCE_PREFIX}-node-$((i+1))"
  36. NODE_CONTAINER_SUBNETS[$i]="${NODE_CONTAINER_SUBNET_BASE}.$((i+1)).1/24"
  37. NODE_CONTAINER_ADDRS[$i]="${NODE_CONTAINER_SUBNET_BASE}.$((i+1)).1"
  38. NODE_CONTAINER_NETMASKS[$i]="255.255.255.0"
  39. VAGRANT_NODE_NAMES[$i]="node-$((i+1))"
  40. done
  41. CLUSTER_IP_RANGE="${CLUSTER_IP_RANGE:-10.246.0.0/16}"
  42. SERVICE_CLUSTER_IP_RANGE=10.247.0.0/16 # formerly PORTAL_NET
  43. # Since this isn't exposed on the network, default to a simple user/passwd
  44. MASTER_USER="${MASTER_USER:-vagrant}"
  45. MASTER_PASSWD="${MASTER_PASSWD:-vagrant}"
  46. # Admission Controllers to invoke prior to persisting objects in cluster
  47. # If we included ResourceQuota, we should keep it at the end of the list to prevent incremeting quota usage prematurely.
  48. ADMISSION_CONTROL=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,ResourceQuota
  49. # Optional: Enable node logging.
  50. ENABLE_NODE_LOGGING=false
  51. LOGGING_DESTINATION=elasticsearch
  52. # Optional: When set to true, Elasticsearch and Kibana will be setup as part of the cluster bring up.
  53. ENABLE_CLUSTER_LOGGING=false
  54. ELASTICSEARCH_LOGGING_REPLICAS=1
  55. # Optional: Cluster monitoring to setup as part of the cluster bring up:
  56. # none - No cluster monitoring setup
  57. # influxdb - Heapster, InfluxDB, and Grafana
  58. # google - Heapster, Google Cloud Monitoring, and Google Cloud Logging
  59. ENABLE_CLUSTER_MONITORING="${KUBE_ENABLE_CLUSTER_MONITORING:-influxdb}"
  60. # Extra options to set on the Docker command line. This is useful for setting
  61. # --insecure-registry for local registries, or globally configuring selinux options
  62. # TODO Enable selinux when Fedora 21 repositories get an updated docker package
  63. # see https://bugzilla.redhat.com/show_bug.cgi?id=1216151
  64. #EXTRA_DOCKER_OPTS="${EXTRA_DOCKER_OPTS:-} -b=cbr0 --selinux-enabled --insecure-registry 10.0.0.0/8"
  65. EXTRA_DOCKER_OPTS="${EXTRA_DOCKER_OPTS:-} --insecure-registry 10.0.0.0/8 -s overlay"
  66. # Flag to tell the kubelet to enable CFS quota support
  67. ENABLE_CPU_CFS_QUOTA="${KUBE_ENABLE_CPU_CFS_QUOTA:-true}"
  68. # Optional: Install cluster DNS.
  69. ENABLE_CLUSTER_DNS="${KUBE_ENABLE_CLUSTER_DNS:-true}"
  70. DNS_SERVER_IP="10.247.0.10"
  71. DNS_DOMAIN="cluster.local"
  72. DNS_REPLICAS=1
  73. # Optional: Install Kubernetes UI
  74. ENABLE_CLUSTER_UI="${KUBE_ENABLE_CLUSTER_UI:-true}"
  75. # Optional: Enable setting flags for kube-apiserver to turn on behavior in active-dev
  76. RUNTIME_CONFIG="${KUBE_RUNTIME_CONFIG:-}"
  77. # Determine extra certificate names for master
  78. octets=($(echo "$SERVICE_CLUSTER_IP_RANGE" | sed -e 's|/.*||' -e 's/\./ /g'))
  79. ((octets[3]+=1))
  80. service_ip=$(echo "${octets[*]}" | sed 's/ /./g')
  81. MASTER_EXTRA_SANS="IP:${service_ip},DNS:kubernetes,DNS:kubernetes.default,DNS:kubernetes.default.svc,DNS:kubernetes.default.svc.${DNS_DOMAIN},DNS:${MASTER_NAME}"
  82. NETWORK_PROVIDER="${NETWORK_PROVIDER:-none}" # opencontrail, kubenet, etc
  83. if [ "${NETWORK_PROVIDER}" == "kubenet" ]; then
  84. CLUSTER_IP_RANGE="${CONTAINER_SUBNET}"
  85. fi
  86. # OpenContrail networking plugin specific settings
  87. OPENCONTRAIL_TAG="${OPENCONTRAIL_TAG:-R2.20}"
  88. OPENCONTRAIL_KUBERNETES_TAG="${OPENCONTRAIL_KUBERNETES_TAG:-master}"
  89. OPENCONTRAIL_PUBLIC_SUBNET="${OPENCONTRAIL_PUBLIC_SUBNET:-10.1.0.0/16}"
  90. # Optional: if set to true, kube-up will configure the cluster to run e2e tests.
  91. E2E_STORAGE_TEST_ENVIRONMENT=${KUBE_E2E_STORAGE_TEST_ENVIRONMENT:-false}
  92. # Default fallback NETWORK_IF_NAME, will be used in case when no 'VAGRANT-BEGIN' comments were defined in network-script
  93. export DEFAULT_NETWORK_IF_NAME="eth0"