diff options
Diffstat (limited to 'xci')
-rwxr-xr-x | xci/installer/kubespray/deploy.sh | 32 | ||||
-rw-r--r-- | xci/installer/kubespray/files/k8s-cluster.yml | 7 | ||||
-rw-r--r-- | xci/installer/kubespray/playbooks/configure-opnfvhost.yml | 7 |
3 files changed, 43 insertions, 3 deletions
diff --git a/xci/installer/kubespray/deploy.sh b/xci/installer/kubespray/deploy.sh index b68fec90..7695894b 100755 --- a/xci/installer/kubespray/deploy.sh +++ b/xci/installer/kubespray/deploy.sh @@ -79,4 +79,36 @@ ssh root@$OPNFV_HOST_IP "set -o pipefail; cd releng-xci/.cache/repos/kubespray;\ -i opnfv_inventory/inventory.cfg cluster.yml -b | tee setup-kubernetes.log" scp root@$OPNFV_HOST_IP:~/releng-xci/.cache/repos/kubespray/setup-kubernetes.log \ $LOG_PATH/setup-kubernetes.log +echo +echo "-----------------------------------------------------------------------" echo "Info: Kubernetes installation is successfully completed!" +echo "-----------------------------------------------------------------------" + +# Configure the kubernetes authentication in opnfv host. +ssh root@$OPNFV_HOST_IP "mkdir -p ~/.kube/;\ + cp -f ~/admin.conf ~/.kube/config; \ + cp -f ~/kubectl /usr/local/bin" + +echo "Login opnfv host ssh root@$OPNFV_HOST_IP +according to the user-guide to create a service +https://kubernetes.io/docs/user-guide/walkthrough/k8s201/" + +echo +echo "-----------------------------------------------------------------------" +echo "Info: Kubernetes login details" +echo "-----------------------------------------------------------------------" + +# Get the dashborad URL +DASHBOARD_SERVICE=$(ssh root@$OPNFV_HOST_IP "kubectl get service -n kube-system |grep kubernetes-dashboard") +DASHBOARD_PORT=$(echo ${DASHBOARD_SERVICE} | awk '{print $5}' |awk -F "[:/]" '{print $2}') +KUBER_SERVER_URL=$(ssh root@$OPNFV_HOST_IP "grep -r server ~/.kube/config") +echo "Info: Kubernetes Dashboard URL:" +echo $KUBER_SERVER_URL | awk '{print $2}'| sed -n "s#:[0-9]*\$#:$DASHBOARD_PORT#p" + +# Get the dashborad user and password +MASTER_IP=$(echo ${KUBER_SERVER_URL} | awk '{print $2}' |awk -F "[:/]" '{print $4}') +USER_CSV=$(ssh root@$MASTER_IP " cat /etc/kubernetes/users/known_users.csv") +USERNAME=$(echo $USER_CSV |awk -F ',' '{print $2}') +PASSWORD=$(echo $USER_CSV |awk -F ',' '{print $1}') +echo "Info: Dashboard username: ${USERNAME}" +echo "Info: Dashboard password: ${PASSWORD}" diff --git a/xci/installer/kubespray/files/k8s-cluster.yml b/xci/installer/kubespray/files/k8s-cluster.yml index aeee573a..20d3091d 100644 --- a/xci/installer/kubespray/files/k8s-cluster.yml +++ b/xci/installer/kubespray/files/k8s-cluster.yml @@ -157,7 +157,7 @@ kube_users: ## It is possible to activate / deactivate selected authentication methods (basic auth, static token auth) #kube_oidc_auth: false -#kube_basic_auth: false +kube_basic_auth: true #kube_token_auth: false @@ -270,9 +270,10 @@ local_volumes_enabled: false persistent_volumes_enabled: false # Make a copy of kubeconfig on the host that runs Ansible in GITDIR/artifacts -# kubeconfig_localhost: false +kubeconfig_localhost: true # Download kubectl onto the host that runs Ansible in GITDIR/artifacts -# kubectl_localhost: false +kubectl_localhost: true +artifacts_dir: "{{ ansible_env.HOME }}" # dnsmasq # dnsmasq_upstream_dns_servers: diff --git a/xci/installer/kubespray/playbooks/configure-opnfvhost.yml b/xci/installer/kubespray/playbooks/configure-opnfvhost.yml index 4db9ac1a..d6e1d7b8 100644 --- a/xci/installer/kubespray/playbooks/configure-opnfvhost.yml +++ b/xci/installer/kubespray/playbooks/configure-opnfvhost.yml @@ -62,6 +62,13 @@ state: present update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}" when: XCI_FLAVOR == 'aio' + + - name: change dashboard server type to NodePort + lineinfile: + path: "{{ remote_xci_path }}/.cache/repos/kubespray/roles/kubernetes-apps/ansible/templates/dashboard.yml.j2" + insertafter: 'targetPort' + line: " type: NodePort" + - name: pip install ansible pip: name: ansible |