{"id":1751,"date":"2023-06-06T10:27:26","date_gmt":"2023-06-06T10:27:26","guid":{"rendered":"https:\/\/community.5gasp.eu\/?page_id=1751"},"modified":"2023-06-06T10:27:26","modified_gmt":"2023-06-06T10:27:26","slug":"kubernetes-cluster-deployment-and-osm-attachment","status":"publish","type":"page","link":"https:\/\/community.5gasp.eu\/index.php\/kubernetes-cluster-deployment-and-osm-attachment\/","title":{"rendered":"Kubernetes cluster deployment and OSM attachment"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">1)&nbsp;&nbsp;&nbsp; Preparing the Cluster Deployment Environment<\/h1>\n\n\n\n<p>The first step is to prepare a number of VMs equal to the number of nodes you want the cluster to comprise of, including the controller\/master node. These VMs will be the supporting hardware for each cluster node and provide the needed entity separation. Between Kubernetes cluster nodes.<\/p>\n\n\n\n<p>SSH into each of the (soon to be kubernetes cluster) nodes (previously prepared) Ubuntu 20.04 VMs, and for each, do the following:&nbsp;<\/p>\n\n\n\n<ol class=\"wp-block-list\" type=\"a\">\n<li>&#8220;sudo passwd root&#8221; to change root user password\u00a0<ol><li>sudo su&nbsp;<\/li><\/ol><ol><li>sudo nano \/etc\/ssh\/sshd_config&nbsp;<ol><li>Add\/uncomment and modify &#8220;PermitRootLogin yes&#8221;&nbsp;<\/li><\/ol><\/li><\/ol>\n<ol class=\"wp-block-list\">\n<li>sudo service sshd restart&nbsp;<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n\n\n\n<h1 class=\"wp-block-heading\">2)&nbsp;&nbsp;&nbsp; Preparation of Deployment Machine and Deployment Setup Files<\/h1>\n\n\n\n<p>SSH keys also have to be copied to <strong>all <\/strong>the nodes, from the deployment machine (presented below), as per the following tutorial <a href=\"https:\/\/www.webhi.com\/how-to\/how-to-use-a-private-key-for-ssh-authentication\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.webhi.com\/how-to\/how-to-use-a-private-key-for-ssh-authentication\/<\/a> .<\/p>\n\n\n\n<p>kubespray has to be cloned and ansible installed on the machine to deploy the cluster (via the kubespray readme &#8211; <a href=\"https:\/\/github.com\/kubernetes-sigs\/kubespray.git\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/kubernetes-sigs\/kubespray.git<\/a> ) note: I used <strong>ansible [core 2.12.3] <\/strong>and the latest version (<strong>v2.21.0<\/strong>) of <strong>Kubespray<\/strong>.<\/p>\n\n\n\n<p>Then, the inventory\/mycluster\/hosts.yaml file needs to be configured (automatically, via the provided script, and then verified, to look like this:<\/p>\n\n\n\n<p>for a 3-node cluster deployment \u2013 then, as the README says, check all relevant variables \u2013 I only changed the <strong>Kubernetes <\/strong>version to<strong> 1.24.0<\/strong>, but now this tutorial should work with the latest versions of Kubernetes \u2013 at the time of writing the <strong>default&nbsp; version is<\/strong> <strong>1.26.1<\/strong>&nbsp;<\/p>\n\n\n\n<p>Once the ssh keys are also copied to <strong>all <\/strong>the nodes, specifically for authentication-less ssh access, the playbook can be applied\/executed &#8211; <strong>NOTE:<\/strong> it is safer to do all of this from the root of the machine where kubespray is applied from, as well!&nbsp;<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">3)&nbsp;&nbsp;&nbsp; Post-deployment Setup and OSM Attachment Preparation<\/h1>\n\n\n\n<p>Once the clusters are up, the storage-class openebs service has to be started on the controller\/master node (tutorial at <a href=\"https:\/\/platform9.com\/learn\/v1.0\/tutorials\/openebs\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/platform9.com\/learn\/v1.0\/tutorials\/openebs<\/a> )&nbsp;<\/p>\n\n\n\n<p>Then the kubernetes admin.conf file can be copied from<strong> \/etc\/kubernetes\/admin.conf<\/strong> to the OSM machine &#8211; <strong>NOTE<\/strong> The IP has to be changed to that of the controller\/master node&nbsp;<\/p>\n\n\n\n<p>Lastly, the cluster can be attached to OSM via the&nbsp;&nbsp;<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">4)&nbsp;&nbsp;&nbsp; OSM K8s Cluster Attachment<\/h1>\n\n\n\n<p><strong>osm &#8211;user 5gasp_univbris &#8211;password 5GASPUNiVBRI$ &#8211;project 5GASP_UNIVBRIS k8scluster-add &#8211;creds k8-5gasp.conf &#8211;version &#8216;1.24.0&#8217; &#8211;vim hpn-site &#8211;description &#8220;Proper K8s cluster deployment&#8221; &#8211;k8s-nets &#8216;{(net1:5GASP-Management)}&#8217; cluster<\/strong>&nbsp;<\/p>\n\n\n\n<p>command&nbsp;<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">5)&nbsp;&nbsp;&nbsp; OSM Community Slack and Engagement<\/h1>\n\n\n\n<p>As this was a well-known issue in the OSM slack, and I was initially referred to it by one of my former colleagues, Navdeep Uniyal, they did not find a solution for the cluster integration of the later versions of Kubernetes, with the latest version of Ansible.<\/p>\n\n\n\n<p><strong><u>IMPORTANT NOTE<\/u><\/strong>: The above versions should be noted and compared to the current versions\u2019 requirements, as Ansible and Kubespray have specific dependency and version requirements. If the above do not work, please consult as follows for debugging purposes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If the cluster cannot be deployed fully, please check the error logs that Ansible produces, and address the errors exactly \u2013 they should be pretty straightforward<\/li>\n\n\n\n<li>If (at a later point) the OSM does not attach the cluster appropriately, please check OSM\u2019s Resource Orchestrator pod\u2019s logs (the Kubernetes pod within the OSM machine should have \u201cRO\u201d within its name, and be associated with the \u201cosm\u201d namespace), and be sure to see if there are any errors related to the cluster attachment command, issued via LCM<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>1)&nbsp;&nbsp;&nbsp; Preparing the Cluster Deployment Environment The first step is to prepare a number of VMs equal to the number of nodes you want the cluster to comprise of, including the controller\/master node. These VMs will be the supporting hardware for each cluster node and provide the needed entity separation. [\u2026]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"pg_page_styles":[],"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"ngg_post_thumbnail":0,"footnotes":""},"class_list":["post-1751","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/community.5gasp.eu\/index.php\/wp-json\/wp\/v2\/pages\/1751","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/community.5gasp.eu\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/community.5gasp.eu\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/community.5gasp.eu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/community.5gasp.eu\/index.php\/wp-json\/wp\/v2\/comments?post=1751"}],"version-history":[{"count":1,"href":"https:\/\/community.5gasp.eu\/index.php\/wp-json\/wp\/v2\/pages\/1751\/revisions"}],"predecessor-version":[{"id":1752,"href":"https:\/\/community.5gasp.eu\/index.php\/wp-json\/wp\/v2\/pages\/1751\/revisions\/1752"}],"wp:attachment":[{"href":"https:\/\/community.5gasp.eu\/index.php\/wp-json\/wp\/v2\/media?parent=1751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}