{"id":1041,"date":"2021-06-04T14:12:43","date_gmt":"2021-06-04T12:12:43","guid":{"rendered":"https:\/\/loeilduse.fr\/?p=1041"},"modified":"2021-06-09T10:37:48","modified_gmt":"2021-06-09T08:37:48","slug":"steps-for-creating-vm-through-kubectl","status":"publish","type":"post","link":"https:\/\/loeilduse.fr\/?p=1041&lang=en","title":{"rendered":"Steps for creating VM through Kubectl"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"size-large aligncenter\" src=\"https:\/\/loeilduse.fr\/wp-content\/uploads\/2021\/06\/VM-POD-Network.png\" width=\"624\" height=\"105\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">To create a virtual machine with vSphere with Tanzu via the kubectl command, there are steps to follow for the administrator and for the developer, they are very simple but that did not prevent me from wasting a little time on the customization side regarding<\/span><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"1\"> the OS part.<\/span><\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">I recommend this article to you to understand the interest of deploying VMs through Kubernetes: <a href=\"https:\/\/loeilduse.fr\/?p=1063&amp;lang=en\">Deploy VM in and via Kubernetes<\/a>.<\/span> <span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"1\">My colleague&#8217;s blog:\u00a0<a href=\"https:\/\/core.vmware.com\/blog\/introducing-virtual-machine-provisioning-kubernetes-vm-service\">Introducing Virtual Machine Provisioning, via Kubernetes with VM service | VMware<\/a><\/span><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"2\"> is also very well detailed.<\/span><\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"4\">In the last part of this article, I will provide some details on the Content Library part and on the YAML part.<\/span> <span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"6\"><span class=\"VIiyi\" lang=\"en\">But first, let&#8217;s review the parts to be done on the administrator side and the developer side.<\/span> <\/span><\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\"><span style=\"font-family: trebuchet ms, geneva, sans-serif;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large\" src=\"https:\/\/loeilduse.fr\/wp-content\/uploads\/2021\/06\/Dev-admin-vwt.png\" width=\"624\" height=\"241\" \/><\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif; font-size: 18pt;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">Regarding the administrator<\/span><\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"2\">The first step is to download the VMs images that are different from those used for TKC (Tanzu Kubernetes Cluster aka Guest Cluster).<\/span> <span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"3\">The images are available in the VMware marketplace, at the time of writing this article there are 2 (Ubuntu and Centos), the current Ubuntu version does not allow the use of persistent volume (PVC) because it is based on<\/span> <span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"4\">a virtual hardware version 10 and at least version 12 is required, this problem will be soon corrected.<\/span> <\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"6\">You have to go to the marketplace and do a search with the keyword &#8220;vm service&#8221;, this allows you to filter (a little) the compatible images =&gt; <a href=\"https:\/\/marketplace.cloud.vmware.com\/services?search=vm%20service\">VMware Marketplace<\/a>.<\/span><\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-family: trebuchet ms, geneva, sans-serif;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large\" src=\"https:\/\/loeilduse.fr\/wp-content\/uploads\/2021\/06\/Marketplace-search-image.png\" width=\"624\" height=\"310\" \/><\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">Then click on the desired image, connect with your MyVMware account.<\/span><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large\" src=\"https:\/\/loeilduse.fr\/wp-content\/uploads\/2021\/06\/Marketplace-sigin.png\" width=\"624\" height=\"79\" \/><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">You have two options, download it then upload it to a local content library<\/span><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large\" src=\"https:\/\/loeilduse.fr\/wp-content\/uploads\/2021\/06\/Marketplace-download.png\" width=\"624\" height=\"105\" \/><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">or retrieve the subscription url to create a content library that will synchronize with the one hosted by VMware.<\/span><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large\" src=\"https:\/\/loeilduse.fr\/wp-content\/uploads\/2021\/06\/Marketplace-subscribe.png\" width=\"624\" height=\"90\" \/><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">Once the image is loaded or the link is filled in, you should have a content library like this:<\/span><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large\" src=\"https:\/\/loeilduse.fr\/wp-content\/uploads\/2021\/06\/content-library-list.png\" width=\"624\" height=\"304\" \/><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">Still from the vSphere interface, we must now create a namespace, grant the rights to the users so that they can connect to it, assign the VM class, the content library and the storage class, which should give this<\/span><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large\" src=\"https:\/\/loeilduse.fr\/wp-content\/uploads\/2021\/06\/namespace-cl-vmclass-perm-storage.png\" width=\"624\" height=\"240\" \/><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">The example above shows once the namespace has been created, how to assign a VM class, a content library, authorize the developers who can consume this namespace, which storage class to use and finally if necessary cap the resources, CPU, memory<\/span> <span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"1\">and storage.<\/span><\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"> <span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"3\">That\u2019s all there is to it on the infrastructure administrator side.<\/span> <\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-family: trebuchet ms, geneva, sans-serif;\"><strong><span class=\"VIiyi\" lang=\"en\" style=\"font-size: 18pt;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"5\">Regarding the developer<\/span> <\/span><\/strong><\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"7\">You need a YAML description for:<\/span> <\/span><\/p>\n<ul style=\"text-align: justify;\">\n<li><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"9\">The configmap which contains the customization of the VM<\/span> <\/span><\/li>\n<li><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"11\">The creation of the VM<\/span> <\/span><\/li>\n<li><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"13\">The Network service if you want to connect to it from an outside network (optional)<\/span> <span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"15\">PVC if you want to use persistent volumes (optional)<\/span> <\/span><\/li>\n<\/ul>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"17\">Via the Kubernetes command, the developer connects with his account to the Namespace provided, he will be able to list the classes of services that he can use as well as the images that he can deploy.<\/span><\/span><\/p>\n<p><span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\"><strong>kubectl get virtualmachineclass<br \/>\n<\/strong><\/span><span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">NAME\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 CPU\u00a0\u00a0 MEMORY\u00a0\u00a0 AGE<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">best-effort-2xlarge\u00a0\u00a0 8\u00a0\u00a0\u00a0\u00a0 64Gi\u00a0\u00a0\u00a0\u00a0 22d<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">best-effort-4xlarge\u00a0\u00a0 16\u00a0\u00a0\u00a0 128Gi\u00a0\u00a0\u00a0 22d<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">best-effort-8xlarge\u00a0\u00a0 32\u00a0 \u00a0\u00a0128Gi\u00a0\u00a0\u00a0 22d<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">best-effort-large\u00a0\u00a0\u00a0\u00a0 4\u00a0\u00a0\u00a0\u00a0 16Gi\u00a0\u00a0\u00a0\u00a0 22d<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">best-effort-medium\u00a0\u00a0\u00a0 2\u00a0\u00a0\u00a0\u00a0 8Gi\u00a0\u00a0\u00a0\u00a0\u00a0 31d<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">best-effort-small\u00a0\u00a0\u00a0\u00a0 2\u00a0\u00a0\u00a0\u00a0 4Gi\u00a0\u00a0\u00a0\u00a0\u00a0 31d<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">best-effort-xlarge\u00a0\u00a0\u00a0 4\u00a0\u00a0\u00a0\u00a0 32Gi\u00a0\u00a0\u00a0\u00a0 22d<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">best-effort-xsmall\u00a0\u00a0\u00a0 2\u00a0\u00a0\u00a0\u00a0 2Gi\u00a0\u00a0\u00a0\u00a0\u00a0 22d<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">..<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">guaranteed-xsmall\u00a0\u00a0\u00a0\u00a0 2\u00a0\u00a0\u00a0\u00a0 2Gi\u00a0\u00a0\u00a0\u00a0\u00a0 22d<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\"><strong>kubectl get virtualmachineimage<br \/>\n<\/strong>NAME\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 VERSION\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 OSTYPE\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 FORMAT\u00a0\u00a0 AGE<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">centos-stream-8-vmservice-v1alpha1-1619529007339\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 centos8_64Guest\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ovf\u00a0\u00a0\u00a0\u00a0\u00a0 4h8m<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">ob-15957779-photon-3-k8s-v1.16.8\u2014vmware.1-tkg.3.60d2ffd\u00a0\u00a0\u00a0 v1.16.8+vmware.1-tkg.3.60d2ffd\u00a0\u00a0\u00a0 vmwarePhoton64Guest\u00a0\u00a0 ovf\u00a0\u00a0\u00a0\u00a0\u00a0 2d19h<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">ob-16466772-photon-3-k8s-v1.17.7\u2014vmware.1-tkg.1.154236c\u00a0\u00a0\u00a0 v1.17.7+vmware.1-tkg.1.154236c\u00a0\u00a0\u00a0 vmwarePhoton64Guest\u00a0\u00a0 ovf\u00a0\u00a0\u00a0\u00a0\u00a0 2d19h<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">ob-16545581-photon-3-k8s-v1.16.12\u2014vmware.1-tkg.1.da7afe7\u00a0\u00a0 v1.16.12+vmware.1-tkg.1.da7afe7\u00a0\u00a0 vmwarePhoton64Guest\u00a0\u00a0 ovf\u00a0\u00a0\u00a0\u00a0\u00a0 2d19h<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u2026\u2026<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">ubuntu-20-1621373774638\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0ubuntu64Guest\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ovf\u00a0\u00a0\u00a0\u00a0\u00a0 4h8m<\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">He can thus create his YAML descriptive files in order to define his resource requirements for his virtual machine (s) and if they wish, he can customize it or them in order to install his tools.<\/span> <\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"2\">The configmap descriptive file, includes the customization of the VM.<\/span> <span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"3\">The 3 important fields to fill in for personalization are:<\/span> <\/span><\/p>\n<ul>\n<li style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"5\">The hostname which contains the OS hostname<\/span> <\/span><\/li>\n<li style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"7\">The public-keys, which contains the public key of a computer from which we will connect to the OS in ssh.<\/span> <\/span><\/li>\n<li style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"9\">The user-data part is, if you wish, the place where we put the contents of the Cloud Init configuration file, it will have to be encrypted with the base64 command<\/span><\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\"><strong>cat loeil-du-se-vm-configmap.yaml<\/strong><\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">apiVersion: v1<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">kind: ConfigMap<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">metadata:<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0 name: loeil-du-se-vm-configmap # The name of the ConfigMap, must be the same as in the VirtualMachine<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0 namespace: loeil-du-se<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">data:<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 # OVF Keys values required by the VM at provision time<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 hostname: loeil-du-se<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 public-keys: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDC4Cclh3rN\/l70lBNlwQyK6ZtugxqT\/7HeerHZKPSO0hcl5ZWLvz2+7QG5FqvYbkPP6EomvyDhE2MPnQ0kWaIrumVxYXAbVdpBBKKdTI3xJpewWB2syxgVOXP2ZOrw4cRLFv18rnESGHfsohedyaSB1qvubPWAqBFa+PSS4xh3zKalUknwc7Bs14fci8tEwEg8cpvNsqvrPZliJ6qTYFGqKuG6Ct+y449JNW6k6itTepgSYvUdJfjBTxk5tDzBdWz28km5N7lxgUB0rIWgSDl1XLCBrmm+H6bkHtD59MxAuxwLjih4tS4PzspcVjwWiJhd0HH7u2wbsPLCrrAX7am4EP40zphu9IR+fVxk+2jp7eD2uXPS6p9sDPEWHl6wGclI7pnfuoyvcn+CIwCtMweLuUw5MPj2eIIXcBhqUffeVAXVHrx8+e7+yHvqfyhqm2J9Ay3yt3zvAcXW0VqDxfvnfmv8sc9VNUW+8fUeyoo4b4uZRLLSf2DHM8= root@fbenrejdal-z01 # the public key to be able to do ssh without password from my laptop<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 user-data: | # optional, enter the base64 cloud init encodded file, the result key could be a one line key or a multiple lines key. watch out the indentation, the line should be start under the &#8220;r&#8221; of user-data<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0\u00a0 I2Nsb3VkLWNvbmZpZwojIFdBVENIT1VUIHRoZSBmaXJzdCBsaW5lIG11c3Qgc3RhcnQgd2l0aCAj<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0\u00a0 Y2xvdWQtY29uZmlnCmdyb3VwczoKICAtIGRldm9wcwp1c2VyczoKICAtIGRlZmF1bHQgIyBDcmVh<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0\u00a0 dGUgdGhlIGRlZmF1bHQgdXNlciBmb3IgdGhlIE9TCiAgLSBuYW1lOiBmYmUKICAgIHNzaC1hdXRo<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0\u00a0 b3JpemVkLWtleXM6ICMgdGhlIHB1YmxpYyBrZXkgb2YgbXkgbGFwdG9wLCBpdCBjb3VsZCBhbHNv<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0\u00a0 IGJlIGZpbGxlZCBpbiB0aGUgT1ZGIHByb3BlcnR5CiAgICAgIC0gc3NoLXJzYSBBQUFBQjNOemFD<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0\u00a0 MXljMkVBQUFBREFRQUJBQUFCZ1FEQzRDY2xoM3JOL2w3MGxCTmx3UXlLNlp0dWd4cVRHLzdIZWVy<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0\u00a0 SFpLUFNPMGhjbDVaV0x2ejIrN1FHNUZxdllia1BQNkVvbXZ5RGhFMk1QblEwa1dhSXJ1bVZ4WVhB<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0\u00a0 YlZkcEJCS0tkVEkzeEpwZXdXL0Iyc3l4Z1ZPWFAyWk9ydzRjUkxGdjE4cm5FU0dIZisvc29oZWR5<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0\u00a0 YVNCMXF2dWJQV0FxQkZhK1BTUzR4aDZELzN6S2FsVWtud2M3QnMxNGZjaTh0RXdFZzhjcHZOc3F2<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0\u00a0 clBabGlKNnFUWUZHcUt1RzZDdCt5NDQ5Sk5XNms2aXRUZXBnU1l2VWRKZmpCVHhrNXREekJkV3oy<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0\u00a0 OGttNU43bHhnVUIwcklXZ1NEbDFYTENCcm1tK0g2YmtIdEQ1OU14QXV4d0xqaWg0dFM0UHpzcGNW<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0\u00a0 dGFydCBtb25nb2QK<\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">The base64 is obtained as follows:<\/span><\/span><\/p>\n<p><span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">base64\u00a0 loeil-du-se-vm-cloud-init.yaml<\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">Its content in clear:<\/span><\/span><\/p>\n<p><span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\"><strong>cat\u00a0 loeil-du-se-vm-cloud-init.yaml<br \/>\n<\/strong>#cloud-config<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\"># WATCHOUT the first line must start with #cloud-config<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">groups:<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 \u2013 devops<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">users:<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 \u2013 default # Create the default user for the OS<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 \u2013 name: fbe<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 ssh-authorized-keys: # the public key of my laptop, it could also be filled in the OVF property<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0 \u2013 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDC4Cclh3rN\/l70lBNlwQyK6ZtugxqTG7HeerHZKPSO0hcl5ZWLvz2+7QG5FqvYbkPP6EomvyDhE2MPnQ0kWaIrumVxYXAbVdpBBKKdTI3xJpewWB2syxgVOXP2ZOrw4cRLFv18rnESGHf+sohedyaSB1qvubPWAqBFa+PSS4xh6D3zKalUknwc7Bs14fci8tEwEg8cpvNsqvrPZliJ6qTYFGqKuG6Ct+y449JNW6k6itTepgSYvUdJfjBTxk5tDzBdWz28km5N7lxgUB0rIWgSDl1XLCBrmm+H6bkHtD59MxAuxwLjih4tS4PzspcVjwWiJhd0HH7u2wbsPLCrrAX7am4EP40zphu9IR+fVxk+2jp7eD2uXPS6p9sDPEWHl6wGclI7pnfuoyvcn+CIwCtMweLuUw5MPj2eIIXcBhqUffeVAXVHrx8+e7+yHvqfyhqm2J9Ay3yt3zvAcXW0VqDxfvnfmv8sc9VNUW+8fUeyoo4b4uZRLLSf2DHM8= root@fbenrejdal-z01<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0 groups: sudo, devops<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0 shell: \/bin\/bash<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0 passwd: VMware1!<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0 sudo: [\u2018ALL=(ALL) NOPASSWD:ALL\u2019] # the user fbe will not need to enter password when using sudo<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 ssh_pwauth: true<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 chpasswd:<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 list: |<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0 fbe:VMware1! # in case you want to change password of users<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0 expire: false\u00a0 # if you don&#8217;t want your password to expire<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">runcmd: # Example of runcmd to install MongoDB. Cloud Init has also APT keyword to do installation<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 \u2013 echo \u201cdeb [ arch=amd64,arm64 ] https:\/\/repo.mongodb.org\/apt\/ubuntu focal\/mongodb-org\/4.4 multiverse\u201d | tee \/etc\/apt\/sources.list.d\/mongodb-org-4.4.list<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 \u2013 wget -qO \u2013 https:\/\/www.mongodb.org\/static\/pgp\/server-4.4.asc | apt-key add \u2013<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 \u2013 echo \u201cdeb [ arch=amd64,arm64 ] https:\/\/repo.mongodb.org\/apt\/ubuntu focal\/mongodb-org\/4.4 multiverse\u201d | tee \/etc\/apt\/sources.list.d\/mongodb-org-4.4.list<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 \u2013 apt-get update<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 \u2013 apt-get install -y mongodb-org<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 \u2013 echo \u201cmongodb-org hold\u201d | dpkg \u2013set-selections<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 \u2013 echo \u201cmongodb-org-server hold\u201d | dpkg \u2013set-selections<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 \u2013 echo \u201cmongodb-org-shell hold\u201d | dpkg \u2013set-selections<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 \u2013 echo \u201cmongodb-org-mongos hold\u201d | dpkg \u2013set-selections<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 \u2013 echo \u201cmongodb-org-tools hold\u201d | dpkg \u2013set-selections<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 \u2013 sed -i \u2018s\/127.0.0.1\/0.0.0.0\/\u2019 \/etc\/mongod.conf<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 \u2013 ufw allow from any to any port 27017 proto tcp<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 \u2013 sleep 2<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 \u2013 systemctl start mongod<\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">Very very important, the file must absolutely start with # cloud-config and nothing else.<\/span> <span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"1\">It&#8217;s still a classic Cloud Init file.<\/span> <span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"3\">If you&#8217;re not too familiar with Cloud Init, I&#8217;ve put some comments there to make it a bit more readable.<\/span><\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">The VM description file<\/span><\/span><\/p>\n<p><span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\"><strong>cat loeil-du-se-vm-deployment.yaml<br \/>\n<\/strong>apiVersion: vmoperator.vmware.com\/v1alpha1<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">kind: VirtualMachine<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">metadata:<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 name: loeil-du-se-vm<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 namespace: loeil-du-se<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">labels:<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 vm: loeil-du-se-vm<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">spec:<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 imageName: ubuntu-20-1621373774638 #the image must exist on the content library and must be listed with the command kubectl get virtualmachineimage<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 className: best-effort-xsmall<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 powerState: poweredOn<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 storageClass: silver-storage-policy<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 networkInterfaces:<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 \u2013 networkType: nsx-t #must be nsx-t or vsphere-distributed depending on your install.<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0 # networkName: if vsphere-distributed you must specify the name of the network portgroup<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 vmMetadata:<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0 configMapName: loeil-du-se-vm-configmap # The K8s configmap where personalization is stored<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0 transport: OvfEnv<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">#<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">#\u00a0 when writing this article, the available image ubuntu (ubuntu-20-1621373774638) is not able to use volume because is using virtual hardware version 10<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">#\u00a0 Instead you can use the centos image (centos-stream-8-vmservice-v1alpha1-1619529007339)<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">#\u00a0 volumes: #when writing this article, the volume mount parameter is not use, the volume is seen in the guest but should be formated and mounted manualy<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">#\u00a0\u00a0\u00a0 \u2013 name: loeil-du-se-volume<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">#\u00a0\u00a0\u00a0\u00a0\u00a0 persistentVolumeClaim:<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">#\u00a0\u00a0\u00a0\u00a0\u00a0 claimName: loeil-du-se-pvc<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">#\u00a0\u00a0\u00a0\u00a0\u00a0 readOnly: false<\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">Optional, the description file of the network service<\/span> <span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"2\">In my example, I created a service of type LoadBalancer to connect in ssh from an external network to that of the PODs.<\/span> <\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"4\">Please note, the kind is not Service as usual but VirtualMachineService<\/span><\/span><\/p>\n<p><span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\"><strong>cat loeil-du-se-vm-service.yaml<br \/>\n<\/strong>apiVersion: vmoperator.vmware.com\/v1alpha1<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">kind: VirtualMachineService<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">metadata:<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 name: loeil-du-se-vm<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">spec:<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 selector:<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0 vm: loeil-du-se-vm<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 type: LoadBalancer<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0 ports:<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0 \u2013 name: ssh<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0 port: 22<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0 protocol: TCP<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0 targetPort: 22<\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">Once the YAML files are created, all that remains is to have them taken into account by Kubernetes.<\/span><\/span><\/p>\n<p><span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">Kubectl create -f loeil-du-se-vm-configmap.yaml<\/span><\/p>\n<p><span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">Kubectl create -f loeil-du-se-vm-deployment.yaml<\/span><\/p>\n<p><span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">Kubectl create -f loeil-du-se-vm-service.yaml<\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif; font-size: 12pt;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">To verify the creation of the VM:<\/span> <\/span><\/p>\n<p><span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">Kubectl get vm<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-family: trebuchet ms, geneva, sans-serif; font-size: 12pt;\">To know more about it:<\/span><\/p>\n<p><span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">Kubectl describe vm loeil-du-se-vm<\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">It remains a classic VM, so it will benefit from HA and vMotion (via DRS or host maintenance mode).<\/span> <span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"1\">On the other hand, it is &#8220;Developer Managed&#8221;, that is to say that it cannot be managed via vCenter, you will not see the contents of the console for example.<\/span><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large\" src=\"https:\/\/loeilduse.fr\/wp-content\/uploads\/2021\/06\/vm-developper-managed.png\" width=\"537\" height=\"41\" \/><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"> <span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"3\">One tip though, check which ESXi the VM is running on, then connect directly to the ESXi through a browser and there you will have access to the console.<\/span> <\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"5\">To connect in ssh, if you have access via a loadbalancer like me, you can connect to it directly, otherwise you will have to go through a bounce POD (like busybox, alpine or other) and do an ssh with the IP address on<\/span> <span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"6\">the POD network.<\/span> <span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"7\">You can find it as follows:<\/span><\/span><\/p>\n<p><span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">kubectl get vm loeil-du-se-vm -o jsonpath='{.status.vmIp}\u2019; echo<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">10.244.0.130<\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">The ssh must be done via the user entered in the Cloud Init, I had set fbe, it looks like this:<\/span><\/span><\/p>\n<p><span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">kubectl get svc loeil-du-se-vm<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">NAME\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 TYPE\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 CLUSTER-IP\u00a0\u00a0\u00a0 EXTERNAL-IP\u00a0\u00a0\u00a0 PORT(S)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 AGE<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">loeil-du-se-vm\u00a0\u00a0 LoadBalancer\u00a0\u00a0 10.96.1.108\u00a0\u00a0 172.20.18.71\u00a0\u00a0 22:32148\/TCP\u00a0\u00a0 2d22h<\/span><\/p>\n<p><span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">ssh\u00a0<a href=\"mailto:fbe@172.20.18.71\">fbe@172.20.18.71<\/a><\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\u2026<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">To run a command as administrator (user \u201croot\u201d), use \u201csudo &lt;command&gt;\u201d.<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">See \u201cman sudo_root\u201d for details.<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">fbe@loeil-du-se:~$<\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">If the ssh does not work, it is because the user was not taken into account by Cloud Init, try with root to obtain the default user, generally ubuntu for Ubuntu and cloud-user for CentOS:<\/span> <\/span><\/p>\n<p><span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">ssh roo@172.20.18.71<\/span><br \/>\n<span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">Please login as the user \u201cubuntu\u201d rather than the user \u201croot\u201d.<\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">If you have the error below, it is because the laptop from which you are connecting does not have the public ssh key entered or there is an error in it, so you must check the key appearing in<\/span> <span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"1\">the configmap file:<\/span> <\/span><\/p>\n<p><span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">fbe@172.20.18.71: Permission denied (publickey,password).<\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"0\">To debug Cloud Init, you must connect to the vm os via ssh or via the console and look at the log <span style=\"font-family: courier new, courier, monospace; font-size: 8pt;\">\/var\/log\/cloud-init-output.log<\/span><\/span> <\/span><\/p>\n<p style=\"text-align: justify;\"><span class=\"VIiyi\" lang=\"en\" style=\"font-family: trebuchet ms, geneva, sans-serif;\"><span class=\"JLqJ4b ChMk0b\" data-language-for-alternatives=\"en\" data-language-to-translate-into=\"fr\" data-phrase-index=\"2\">There you go, feel free to ping me if you need more information.<\/span> <\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; To create a virtual machine with vSphere with Tanzu via the kubectl command, there are steps to follow for the administrator and for the developer, they are very simple but that did not prevent me from wasting a little time on the customization side regarding the OS part. I recommend this article to you<\/p><\/div>\n<div class=\"blog-btn\"><a href=\"https:\/\/loeilduse.fr\/?p=1041&#038;lang=en\" class=\"home-blog-btn\">Lire la suite<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[401],"tags":[477,479,481,483,485,487,489,491,496,494,458],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/loeilduse.fr\/index.php?rest_route=\/wp\/v2\/posts\/1041"}],"collection":[{"href":"https:\/\/loeilduse.fr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/loeilduse.fr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/loeilduse.fr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/loeilduse.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1041"}],"version-history":[{"count":11,"href":"https:\/\/loeilduse.fr\/index.php?rest_route=\/wp\/v2\/posts\/1041\/revisions"}],"predecessor-version":[{"id":1068,"href":"https:\/\/loeilduse.fr\/index.php?rest_route=\/wp\/v2\/posts\/1041\/revisions\/1068"}],"wp:attachment":[{"href":"https:\/\/loeilduse.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1041"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/loeilduse.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1041"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/loeilduse.fr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1041"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}