Automatic merge from submit-queue Enable setting up Kubernetes cluster in Ubuntu on Azure Implement basic cloud provider functionality to deploy Kubernetes on Azure. SaltStack is used to deploy Kubernetes on top of Ubuntu virtual machines. OpenVpn provides network connectivity. For kubelet authentication, we use basic authentication (username and password). The scripts use the legacy Azure Service Management APIs. We have set up a nightly test job in our Jenkins server for federated testing to run the e2e test suite on Azure. With the cloud provider scripts in this commit, 14 e2e test cases pass in this environment. We plan to implement additional Azure functionality to support more test cases. <!-- Reviewable:start --> --- This change is [<img src="http://reviewable.k8s.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](http://reviewable.k8s.io/reviews/kubernetes/kubernetes/21207) <!-- Reviewable:end -->
168 lines
6.5 KiB
Plaintext
168 lines
6.5 KiB
Plaintext
{% set cluster_name = "" -%}
|
|
{% set cluster_cidr = "" -%}
|
|
{% set allocate_node_cidrs = "" -%}
|
|
{% set service_cluster_ip_range = "" %}
|
|
{% set terminated_pod_gc = "" -%}
|
|
|
|
|
|
{% if pillar['instance_prefix'] is defined -%}
|
|
{% set cluster_name = "--cluster-name=" + pillar['instance_prefix'] -%}
|
|
{% endif -%}
|
|
{% if pillar['cluster_cidr'] is defined and pillar['cluster_cidr'] != "" -%}
|
|
{% set cluster_cidr = "--cluster-cidr=" + pillar['cluster_cidr'] -%}
|
|
{% endif -%}
|
|
{% if pillar['service_cluster_ip_range'] is defined and pillar['service_cluster_ip_range'] != "" -%}
|
|
{% set service_cluster_ip_range = "--service_cluster_ip_range=" + pillar['service_cluster_ip_range'] -%}
|
|
{% endif -%}
|
|
# When we're using flannel it is responsible for cidr allocation.
|
|
# This is expected to be a short-term compromise.
|
|
{% if pillar.get('network_provider', '').lower() == 'flannel' %}
|
|
{% set allocate_node_cidrs = "--allocate-node-cidrs=false" -%}
|
|
{% elif pillar.get('network_provider', '').lower() == 'kubenet' %}
|
|
{% set allocate_node_cidrs = "--allocate-node-cidrs=true" -%}
|
|
{% elif pillar['allocate_node_cidrs'] is defined -%}
|
|
{% set allocate_node_cidrs = "--allocate-node-cidrs=" + pillar['allocate_node_cidrs'] -%}
|
|
{% endif -%}
|
|
{% if pillar['terminated_pod_gc_threshold'] is defined -%}
|
|
{% set terminated_pod_gc = "--terminated-pod-gc-threshold=" + pillar['terminated_pod_gc_threshold'] -%}
|
|
{% endif -%}
|
|
|
|
{% set cloud_provider = "" -%}
|
|
{% set cloud_config = "" -%}
|
|
{% set cloud_config_mount = "" -%}
|
|
{% set cloud_config_volume = "" -%}
|
|
{% set additional_cloud_config_mount = "{\"name\": \"usrsharessl\",\"mountPath\": \"/usr/share/ssl\", \"readOnly\": true}, {\"name\": \"usrssl\",\"mountPath\": \"/usr/ssl\", \"readOnly\": true}, {\"name\": \"usrlibssl\",\"mountPath\": \"/usr/lib/ssl\", \"readOnly\": true}, {\"name\": \"usrlocalopenssl\",\"mountPath\": \"/usr/local/openssl\", \"readOnly\": true}," -%}
|
|
{% set additional_cloud_config_volume = "{\"name\": \"usrsharessl\",\"hostPath\": {\"path\": \"/usr/share/ssl\"}}, {\"name\": \"usrssl\",\"hostPath\": {\"path\": \"/usr/ssl\"}}, {\"name\": \"usrlibssl\",\"hostPath\": {\"path\": \"/usr/lib/ssl\"}}, {\"name\": \"usrlocalopenssl\",\"hostPath\": {\"path\": \"/usr/local/openssl\"}}," -%}
|
|
{% set srv_kube_path = "/srv/kubernetes" -%}
|
|
|
|
{% if grains.cloud is defined -%}
|
|
{% if grains.cloud not in ['vagrant', 'vsphere', 'photon-controller', 'azure-legacy'] -%}
|
|
{% set cloud_provider = "--cloud-provider=" + grains.cloud -%}
|
|
{% endif -%}
|
|
{% set service_account_key = "--service-account-private-key-file=/srv/kubernetes/server.key" -%}
|
|
|
|
{% if grains.cloud in [ 'openstack' ] and grains.cloud_config is defined -%}
|
|
{% set cloud_config = "--cloud-config=" + grains.cloud_config -%}
|
|
{% endif -%}
|
|
|
|
{% if grains.cloud in [ 'aws', 'gce' ] and grains.cloud_config is defined -%}
|
|
{% set cloud_config = "--cloud-config=" + grains.cloud_config -%}
|
|
{% set cloud_config_mount = "{\"name\": \"cloudconfigmount\",\"mountPath\": \"" + grains.cloud_config + "\", \"readOnly\": true}," -%}
|
|
{% set cloud_config_volume = "{\"name\": \"cloudconfigmount\",\"hostPath\": {\"path\": \"" + grains.cloud_config + "\"}}," -%}
|
|
{% endif -%}
|
|
|
|
{% if grains.cloud in ['openstack'] -%}
|
|
{% set cloud_config_mount = "{\"name\": \"instanceid\",\"mountPath\": \"/var/lib/cloud/data/instance-id\",\"readOnly\": true}," -%}
|
|
{% set cloud_config_volume = "{\"name\": \"instanceid\",\"hostPath\": {\"path\": \"/var/lib/cloud/data/instance-id\"}}," -%}
|
|
{% endif -%}
|
|
{% endif -%}
|
|
|
|
{% set root_ca_file = "" -%}
|
|
|
|
{% if grains['cloud'] is defined and grains.cloud in [ 'aws', 'gce', 'vagrant', 'vsphere', 'photon-controller', 'openstack', 'azure-legacy'] %}
|
|
{% set root_ca_file = "--root-ca-file=/srv/kubernetes/ca.crt" -%}
|
|
{% endif -%}
|
|
|
|
{% set log_level = pillar['log_level'] -%}
|
|
{% if pillar['controller_manager_test_log_level'] is defined -%}
|
|
{% set log_level = pillar['controller_manager_test_log_level'] -%}
|
|
{% endif -%}
|
|
|
|
{% set params = "--master=127.0.0.1:8080" + " " + cluster_name + " " + cluster_cidr + " " + allocate_node_cidrs + " " + service_cluster_ip_range + " " + terminated_pod_gc + " " + cloud_provider + " " + cloud_config + " " + service_account_key + " " + log_level + " " + root_ca_file -%}
|
|
|
|
|
|
# test_args has to be kept at the end, so they'll overwrite any prior configuration
|
|
{% if pillar['controller_manager_test_args'] is defined -%}
|
|
{% set params = params + " " + pillar['controller_manager_test_args'] -%}
|
|
{% endif -%}
|
|
|
|
{
|
|
"apiVersion": "v1",
|
|
"kind": "Pod",
|
|
"metadata": {
|
|
"name":"kube-controller-manager",
|
|
"namespace": "kube-system",
|
|
"labels": {
|
|
"tier": "control-plane",
|
|
"component": "kube-controller-manager"
|
|
}
|
|
},
|
|
"spec":{
|
|
"hostNetwork": true,
|
|
"containers":[
|
|
{
|
|
"name": "kube-controller-manager",
|
|
"image": "{{pillar['kube_docker_registry']}}/kube-controller-manager:{{pillar['kube-controller-manager_docker_tag']}}",
|
|
"resources": {
|
|
"requests": {
|
|
"cpu": "200m"
|
|
}
|
|
},
|
|
"command": [
|
|
"/bin/sh",
|
|
"-c",
|
|
"/usr/local/bin/kube-controller-manager {{params}} 1>>/var/log/kube-controller-manager.log 2>&1"
|
|
],
|
|
"livenessProbe": {
|
|
"httpGet": {
|
|
"host": "127.0.0.1",
|
|
"port": 10252,
|
|
"path": "/healthz"
|
|
},
|
|
"initialDelaySeconds": 15,
|
|
"timeoutSeconds": 15
|
|
},
|
|
"volumeMounts": [
|
|
{{cloud_config_mount}}
|
|
{{additional_cloud_config_mount}}
|
|
{ "name": "srvkube",
|
|
"mountPath": "{{srv_kube_path}}",
|
|
"readOnly": true},
|
|
{ "name": "logfile",
|
|
"mountPath": "/var/log/kube-controller-manager.log",
|
|
"readOnly": false},
|
|
{ "name": "etcssl",
|
|
"mountPath": "/etc/ssl",
|
|
"readOnly": true},
|
|
{ "name": "varssl",
|
|
"mountPath": "/var/ssl",
|
|
"readOnly": true},
|
|
{ "name": "etcopenssl",
|
|
"mountPath": "/etc/openssl",
|
|
"readOnly": true},
|
|
{ "name": "etcpki",
|
|
"mountPath": "/etc/pki",
|
|
"readOnly": true}
|
|
]
|
|
}
|
|
],
|
|
"volumes":[
|
|
{{cloud_config_volume}}
|
|
{{additional_cloud_config_volume}}
|
|
{ "name": "srvkube",
|
|
"hostPath": {
|
|
"path": "{{srv_kube_path}}"}
|
|
},
|
|
{ "name": "logfile",
|
|
"hostPath": {
|
|
"path": "/var/log/kube-controller-manager.log"}
|
|
},
|
|
{ "name": "etcssl",
|
|
"hostPath": {
|
|
"path": "/etc/ssl"}
|
|
},
|
|
{ "name": "varssl",
|
|
"hostPath": {
|
|
"path": "/var/ssl"}
|
|
},
|
|
{ "name": "etcopenssl",
|
|
"hostPath": {
|
|
"path": "/etc/openssl"}
|
|
},
|
|
{ "name": "etcpki",
|
|
"hostPath": {
|
|
"path": "/etc/pki"}
|
|
}
|
|
]
|
|
}}
|