def initialise_worker(cni):
status_set('maintenance', 'Initialising worker network');
local_ip = get_my_ip();
worker_subnet = retrieve('worker_subnet');
central_ip = retrieve('central_ip');
hostname = run_command('hostname').replace('\n', '');
run_command('ovs-vsctl set Open_vSwitch . \
external_ids:k8s-api-server="%s:8080"' % (central_ip));
run_command('ovn-k8s-overlay minion-init --cluster-ip-subnet="192.168.0.0/16" \
--minion-switch-subnet="%s" --node-name="%s"' % (worker_subnet, hostname));
os.chdir('/tmp/');
run_command('wget https://github.com/containernetworking/cni/releases/download/v0.5.2/cni-amd64-v0.5.2.tgz');
run_command('sudo mkdir -p /opt/cni/bin');
run_command('sudo mkdir -p /etc/cni/net.d');
os.chdir('/opt/cni/bin/');
run_command('sudo tar xvzf /tmp/cni-amd64-v0.5.2.tgz');
status_set('active', 'Worker subnet : %s' % (worker_subnet));
set_state('worker.initialised');
评论列表
文章目录