From 14592c93aa4dd318edd686394bd13a8880c2219b Mon Sep 17 00:00:00 2001 From: Guo Ruijing Date: Mon, 13 Mar 2017 03:06:56 +0800 Subject: Deploy K8s with flannel/weave by fuel plugin 1. add license information 2. add fuel plugin to deploy k8s with flannel/weave: [root@fuel ~]# fuel plugins id | name | version | package_version | releases ---+-----------------+---------+-----------------+--------------------- 9 | fuel-plugin-k8s | 1.0.0 | 4.0.0 | ubuntu (newton-10.0) [root@fuel ~]# fuel nodes id | status | name | cluster | ip | mac | roles | pending_roles | online | group_id ---+--------+------------------+---------+-----------+-------------------+------------+---------------+--------+--------- 15 | ready | Untitled (36:ba) | 5 | 10.20.0.7 | 52:54:00:37:36:ba | compute | | 1 | 5 20 | ready | Untitled (a5:c0) | 5 | 10.20.0.5 | 52:54:00:15:a5:c0 | k8s-master | | 1 | 5 21 | ready | Untitled (f6:58) | 5 | 10.20.0.8 | 42:bc:7f:4a:ed:1e | k8s-slave | | 1 | 5 14 | ready | Untitled (7e:60) | 5 | 10.20.0.6 | 32:20:08:b9:e4:9a | controller | | 1 | 5 [root@fuel ~]# ssh 10.20.0.5 Warning: Permanently added '10.20.0.5' (ECDSA) to the list of known hosts. Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-66-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage Last login: Sun Mar 12 19:30:52 2017 from 10.20.0.2 root@node-20:~# kubectl get nodes NAME STATUS AGE node-20.domain.tld Ready,master 50m node-21.domain.tld Ready 14m root@node-20:~# kubectl get pods NAME READY STATUS RESTARTS AGE busybox 1/1 Running 0 11m Change-Id: I4969c08fb35d0e7354a1cacdf89d739fff2e5eba Signed-off-by: Guo Ruijing --- .../puppet/manifests/k8s-master-install.pp | 22 ++++++++++++++++++++++ .../puppet/manifests/k8s-slave-install.pp | 15 +++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/fuel-plugin/deployment_scripts/puppet/manifests/k8s-master-install.pp create mode 100644 src/fuel-plugin/deployment_scripts/puppet/manifests/k8s-slave-install.pp (limited to 'src/fuel-plugin/deployment_scripts/puppet/manifests') diff --git a/src/fuel-plugin/deployment_scripts/puppet/manifests/k8s-master-install.pp b/src/fuel-plugin/deployment_scripts/puppet/manifests/k8s-master-install.pp new file mode 100644 index 0000000..8c52fad --- /dev/null +++ b/src/fuel-plugin/deployment_scripts/puppet/manifests/k8s-master-install.pp @@ -0,0 +1,22 @@ +notice('MODULAR: k8s-master-install') +# get options + +$network_metadata = hiera_hash('network_metadata') +$k8s_nodes_hash = get_nodes_hash_by_roles($network_metadata, ['k8s-master']) +$k8s_mgmt_ips_hash = get_node_to_ipaddr_map_by_network_role($k8s_nodes_hash, 'management') +$k8s_mgmt_ips = values($k8s_mgmt_ips_hash) + +$network_scheme = hiera_hash('network_scheme') +$service_cidr = $network_scheme['endpoints']['br-mgmt']['IP'] + +$k8s_settings = hiera_hash('fuel-plugin-k8s') +$pod_network = $k8s_settings['pod_network'] +$pod_network_cidr = $k8s_settings['pod_network_cidr'] + +if $operatingsystem == 'Ubuntu' { + exec { 'install k8s master': + command => "/etc/fuel/plugins/fuel-plugin-k8s-1.0/k8s-master-install.sh $k8s_mgmt_ips $service_cidr $pod_network $pod_network_cidr", + path => '/usr/bin:/usr/sbin:/bin:/sbin', + } +} elsif $operatingsystem == 'CentOS' { +} diff --git a/src/fuel-plugin/deployment_scripts/puppet/manifests/k8s-slave-install.pp b/src/fuel-plugin/deployment_scripts/puppet/manifests/k8s-slave-install.pp new file mode 100644 index 0000000..4e4863b --- /dev/null +++ b/src/fuel-plugin/deployment_scripts/puppet/manifests/k8s-slave-install.pp @@ -0,0 +1,15 @@ +notice('MODULAR: k8s-slave-install') +# get options + +$network_metadata = hiera_hash('network_metadata') +$k8s_nodes_hash = get_nodes_hash_by_roles($network_metadata, ['k8s-master']) +$k8s_mgmt_ips_hash = get_node_to_ipaddr_map_by_network_role($k8s_nodes_hash, 'management') +$k8s_mgmt_ips = values($k8s_mgmt_ips_hash) + +if $operatingsystem == 'Ubuntu' { + exec { 'install k8s slave': + command => "/etc/fuel/plugins/fuel-plugin-k8s-1.0/k8s-slave-install.sh $k8s_mgmt_ips", + path => '/usr/bin:/usr/sbin:/bin:/sbin', + } +} elsif $operatingsystem == 'CentOS' { +} -- cgit 1.2.3-korg