You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
4.5 KiB

contiv network support (#1914) * Add Contiv support Contiv is a network plugin for Kubernetes and Docker. It supports vlan/vxlan/BGP/Cisco ACI technologies. It support firewall policies, multiple networks and bridging pods onto physical networks. * Update contiv version to 1.1.4 Update contiv version to 1.1.4 and added SVC_SUBNET in contiv-config. * Load openvswitch module to workaround on CentOS7.4 * Set contiv cni version to 0.1.0 Correct contiv CNI version to 0.1.0. * Use kube_apiserver_endpoint for K8S_API_SERVER Use kube_apiserver_endpoint as K8S_API_SERVER to make contiv talks to a available endpoint no matter if there's a loadbalancer or not. * Make contiv use its own etcd Before this commit, contiv is using a etcd proxy mode to k8s etcd, this work fine when the etcd hosts are co-located with contiv etcd proxy, however the k8s peering certs are only in etcd group, as a result the etcd-proxy is not able to peering with the k8s etcd on etcd group, plus the netplugin is always trying to find the etcd endpoint on localhost, this will cause problem for all netplugins not runnign on etcd group nodes. This commit make contiv uses its own etcd, separate from k8s one. on kube-master nodes (where net-master runs), it will run as leader mode and on all rest nodes it will run as proxy mode. * Use cp instead of rsync to copy cni binaries Since rsync has been removed from hyperkube, this commit changes it to use cp instead. * Make contiv-etcd able to run on master nodes * Add rbac_enabled flag for contiv pods * Add contiv into CNI network plugin lists * migrate contiv test to tests/files Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> * Add required rules for contiv netplugin * Better handling json return of fwdMode * Make contiv etcd port configurable * Use default var instead of templating * roles/download/defaults/main.yml: use contiv 1.1.7 Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
7 years ago
  1. [Unit]
  2. Description=Kubernetes Kubelet Server
  3. Documentation=https://github.com/GoogleCloudPlatform/kubernetes
  4. Wants=network.target
  5. [Service]
  6. Restart=on-failure
  7. RestartSec=10s
  8. TimeoutStartSec=0
  9. LimitNOFILE=40000
  10. ExecStartPre=-/usr/bin/rkt rm --uuid-file=/var/run/kubelet.uuid
  11. ExecStartPre=-/bin/mkdir -p /var/lib/kubelet
  12. {% if kubelet_flexvolumes_plugins_dir is defined %}
  13. ExecStartPre=-/bin/mkdir -p {{ kubelet_flexvolumes_plugins_dir }}
  14. {% endif %}
  15. EnvironmentFile={{kube_config_dir}}/kubelet.env
  16. # stage1-fly mounts /proc /sys /dev so no need to duplicate the mounts
  17. ExecStart=/usr/bin/rkt run \
  18. {% if kubelet_load_modules == true %}
  19. --volume modprobe,kind=host,source=/usr/sbin/modprobe \
  20. --volume lib-modules,kind=host,source=/lib/modules \
  21. {% endif %}
  22. --volume os-release,kind=host,source=/etc/os-release,readOnly=true \
  23. --volume hosts,kind=host,source=/etc/hosts,readOnly=true \
  24. --volume dns,kind=host,source=/etc/resolv.conf \
  25. --volume etc-kubernetes,kind=host,source={{ kube_config_dir }},readOnly=false \
  26. --volume etc-ssl-certs,kind=host,source=/etc/ssl/certs,readOnly=true \
  27. --volume etcd-ssl,kind=host,source={{ etcd_config_dir }},readOnly=true \
  28. --volume run,kind=host,source=/run,readOnly=false \
  29. {% for dir in ssl_ca_dirs -%}
  30. --volume {{ dir | regex_replace('^/(.*)$', '\\1' ) | regex_replace('/', '-') }},kind=host,source={{ dir }},readOnly=true \
  31. {% endfor -%}
  32. --volume var-lib-docker,kind=host,source={{ docker_daemon_graph }},readOnly=false \
  33. --volume var-lib-kubelet,kind=host,source=/var/lib/kubelet,readOnly=false,recursive=true \
  34. --volume var-log,kind=host,source=/var/log \
  35. {% if local_volumes_enabled == true %}
  36. --volume local-volume-base-dir,kind=host,source={{ local_volume_base_dir }},readOnly=false,recursive=true \
  37. {% endif %}
  38. {% if kube_network_plugin in ["calico", "weave", "canal", "flannel", "contiv"] %}
  39. --volume etc-cni,kind=host,source=/etc/cni,readOnly=true \
  40. --volume opt-cni,kind=host,source=/opt/cni,readOnly=true \
  41. --volume var-lib-cni,kind=host,source=/var/lib/cni,readOnly=false \
  42. {% if kubelet_flexvolumes_plugins_dir is defined %}
  43. --volume flexvolumes,kind=host,source={{ kubelet_flexvolumes_plugins_dir }},readOnly=false \
  44. {% endif %}
  45. {% if kubelet_load_modules == true %}
  46. --mount volume=modprobe,target=/usr/sbin/modprobe \
  47. --mount volume=lib-modules,target=/lib/modules \
  48. {% endif %}
  49. --mount volume=etc-cni,target=/etc/cni \
  50. --mount volume=opt-cni,target=/opt/cni \
  51. --mount volume=var-lib-cni,target=/var/lib/cni \
  52. {% endif %}
  53. --mount volume=os-release,target=/etc/os-release \
  54. --mount volume=dns,target=/etc/resolv.conf \
  55. --mount volume=etc-kubernetes,target={{ kube_config_dir }} \
  56. --mount volume=etc-ssl-certs,target=/etc/ssl/certs \
  57. --mount volume=etcd-ssl,target={{ etcd_config_dir }} \
  58. --mount volume=run,target=/run \
  59. {% for dir in ssl_ca_dirs -%}
  60. --mount volume={{ dir | regex_replace('^/(.*)$', '\\1' ) | regex_replace('/', '-') }},target={{ dir }} \
  61. {% endfor -%}
  62. --mount volume=var-lib-docker,target=/var/lib/docker \
  63. --mount volume=var-lib-kubelet,target=/var/lib/kubelet \
  64. --mount volume=var-log,target=/var/log \
  65. --mount volume=hosts,target=/etc/hosts \
  66. {% if local_volumes_enabled == true %}
  67. --mount volume=local-volume-base-dir,target={{ local_volume_base_dir }} \
  68. {% endif %}
  69. {% if kubelet_flexvolumes_plugins_dir is defined %}
  70. --mount volume=flexvolumes,target={{ kubelet_flexvolumes_plugins_dir }} \
  71. {% endif %}
  72. --stage1-from-dir=stage1-fly.aci \
  73. {% if kube_hyperkube_image_repo == "docker" %}
  74. --insecure-options=image \
  75. docker://{{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} \
  76. {% else %}
  77. {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} \
  78. {% endif %}
  79. --uuid-file-save=/var/run/kubelet.uuid \
  80. --debug --exec=/kubelet -- \
  81. $KUBE_LOGTOSTDERR \
  82. $KUBE_LOG_LEVEL \
  83. $KUBELET_API_SERVER \
  84. $KUBELET_ADDRESS \
  85. $KUBELET_PORT \
  86. $KUBELET_HOSTNAME \
  87. $KUBE_ALLOW_PRIV \
  88. $KUBELET_ARGS \
  89. $DOCKER_SOCKET \
  90. $KUBELET_REGISTER_NODE \
  91. $KUBELET_NETWORK_PLUGIN \
  92. $KUBELET_VOLUME_PLUGIN \
  93. $KUBELET_CLOUDPROVIDER
  94. ExecStop=-/usr/bin/rkt stop --uuid-file=/var/run/kubelet.uuid
  95. [Install]
  96. WantedBy=multi-user.target