From e82970e084043c99ac8eab2a3c722dffad9250ce Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Wed, 4 Feb 2015 15:15:41 -0800 Subject: [PATCH] Use certs in vagrant mutli node environment. --- vagrant/provision-master.sh | 7 ++++++- vagrant/provision-minion.sh | 11 ++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/vagrant/provision-master.sh b/vagrant/provision-master.sh index 8d91e0720456..8bd46f857664 100755 --- a/vagrant/provision-master.sh +++ b/vagrant/provision-master.sh @@ -42,7 +42,8 @@ Description=openshift master After=network.service [Service] -ExecStart=/usr/bin/openshift start master --master=http://${MASTER_IP}:8080 --listen=http://0.0.0.0:8080 --nodes=${node_list} +ExecStart=/usr/bin/openshift start master --public-master=${MASTER_IP} --nodes=${node_list} +WorkingDirectory=/vagrant/ [Install] WantedBy=multi-user.target @@ -57,3 +58,7 @@ systemctl start openshift-master.service if [ "${OPENSHIFT_SDN}" == "ovs-simple" ]; then $(dirname $0)/provision-master-sdn.sh $@ fi + +# Set up the KUBECONFIG environment variable for use by the client +echo 'export KUBECONFIG=/vagrant/openshift.local.certificates/admin/.kubeconfig' >> /root/.bash_profile +echo 'export KUBECONFIG=/vagrant/openshift.local.certificates/admin/.kubeconfig' >> /home/vagrant/.bash_profile diff --git a/vagrant/provision-minion.sh b/vagrant/provision-minion.sh index 92386e1b2600..35f656d15581 100755 --- a/vagrant/provision-minion.sh +++ b/vagrant/provision-minion.sh @@ -41,6 +41,11 @@ fi usermod -a -G docker vagrant +# Copy over the certificates directory and modify the kubeconfig file to use the master ip +cp -r /vagrant/openshift.local.certificates / +chown -R vagrant.vagrant /openshift.local.certificates +sed -ie "s/10.0.2.15/${MASTER_IP}/g" /openshift.local.certificates/admin/.kubeconfig + # Create systemd service cat < /usr/lib/systemd/system/openshift-node.service [Unit] @@ -48,7 +53,7 @@ Description=openshift node After=network.service [Service] -ExecStart=/usr/bin/openshift start node --master=http://${MASTER_IP}:8080 +ExecStart=/usr/bin/openshift start node --kubeconfig=/openshift.local.certificates/admin/.kubeconfig --master=https://${MASTER_IP}:8443 Restart=on-failure RestartSec=10s @@ -61,5 +66,9 @@ systemctl daemon-reload systemctl enable openshift-node.service systemctl start openshift-node.service +# Set up the KUBECONFIG environment variable for use by the client +echo 'export KUBECONFIG=/openshift.local.certificates/admin/.kubeconfig' >> /root/.bash_profile +echo 'export KUBECONFIG=/openshift.local.certificates/admin/.kubeconfig' >> /home/vagrant/.bash_profile + # Register with the master #curl -X POST -H 'Accept: application/json' -d "{\"kind\":\"Minion\", \"id\":"${MINION_IP}", \"apiVersion\":\"v1beta1\", \"hostIP\":"${MINION_IP}" }" http://${MASTER_IP}:8080/api/v1beta1/minions