<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>gns3 on Luis Logs</title>
    <link>https://luislogs.com/tags/gns3/</link>
    <description>Recent content in gns3 on Luis Logs</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Sat, 15 Apr 2023 18:40:30 +0900</lastBuildDate><atom:link href="https://luislogs.com/tags/gns3/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Install k3s on Ubuntu Server 22.04</title>
      <link>https://luislogs.com/posts/install-k3s-on-ubuntu-server-22-04/</link>
      <pubDate>Sat, 15 Apr 2023 18:40:30 +0900</pubDate>
      
      <guid>https://luislogs.com/posts/install-k3s-on-ubuntu-server-22-04/</guid>
      <description>While working on creating my own kubernetes cluster I initially wanted to go with the official documentation for the installation process. But then I thought why not explore other distributions that can even simplify and reduce the time of the whole deployment process. This is when I came across k3s which claims to be an easier way of installing and managing kubernetes.
K3s makes use of containerd as the default container platform but I opted to go with docker since I want to become more familiar with it.</description>
      <content:encoded><![CDATA[<p>While working on creating my own kubernetes cluster I initially wanted to go with the official documentation for the installation process. But then I thought why not explore other distributions that can even simplify and reduce the time of the whole deployment process. This is when I came across k3s which claims to be an easier way of installing and managing kubernetes.</p>
<p>K3s makes use of containerd as the default container platform but I opted to go with docker since I want to become more familiar with it. Note that at this time docker is still considered experimental with k3s as written in the official documentation but I still went on with it anyway. In the following steps I also included how you can execute the kubectl commands without the need of sudo and how they can be executed from a remote machine.</p>
<h3 id="installation-on-master-node">Installation on master node</h3>
<p>I have the following setup at the moment where my cluster has a node subnet of 20.0.0.0/24.</p>
<p>
    <img src="/posts/install-k3s-on-ubuntu-server-22-04/20230415_1.png" alt="alt text">
  </p>
<p>Before anything else, modify the hosts on file on each node to reflect the IP and hostnames of the your entire cluster:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1 localhost
</span></span><span class="line"><span class="cl">20.0.0.10 k8s-master m
</span></span><span class="line"><span class="cl">20.0.0.11 k8s-worker-1 w1
</span></span><span class="line"><span class="cl">20.0.0.12 k8s-worker-2 w2
</span></span></code></pre></div><p>
    <img src="/posts/install-k3s-on-ubuntu-server-22-04/20230415_2.png" alt="alt text">
  </p>
<p>Update and upgrade ubuntu packages:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo apt update
</span></span><span class="line"><span class="cl">sudo apt upgrade
</span></span><span class="line"><span class="cl">sudo reboot
</span></span></code></pre></div><p>Install required tools and docker on both master and worker nodes. First add the docker repository.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo apt update
</span></span><span class="line"><span class="cl">sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
</span></span><span class="line"><span class="cl">curl -fsSL https://download.docker.com/linux/ubuntu/gpg <span class="p">|</span> sudo apt-key add -
</span></span><span class="line"><span class="cl">sudo add-apt-repository <span class="s2">&#34;deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable&#34;</span>
</span></span></code></pre></div><p>Install docker:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo apt update <span class="o">&amp;&amp;</span> sudo apt install -y docker-ce
</span></span></code></pre></div><p>Run docker and enable persistence in case of server reboot:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo systemctl start docker
</span></span><span class="line"><span class="cl">sudo systemctl <span class="nb">enable</span> docker
</span></span></code></pre></div><p>Check if docker is running:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo systemctl status docker
</span></span></code></pre></div><p>Install k3s on the master node:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">curl -sfL https://get.k3s.io <span class="p">|</span> sh -s - --docker
</span></span></code></pre></div><p>Check status of k3s:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo systemctl status k3s
</span></span></code></pre></div><p>
    <img src="/posts/install-k3s-on-ubuntu-server-22-04/20230415_3.png" alt="alt text">
  </p>
<p>Check if node is running:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo kubectl get node -o wide
</span></span></code></pre></div><p>
    <img src="/posts/install-k3s-on-ubuntu-server-22-04/20230415_4.png" alt="alt text">
  </p>
<p>As an optional step, unblock ports used by kubernetes. By default firewall will be inactive but in case you have enabled it previously, then you need to perform the following:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo ufw allow 6443/tcp
</span></span><span class="line"><span class="cl">sudo ufw allow 443/tcp
</span></span></code></pre></div><p>You can also check the status of your firewall with:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">ufw status
</span></span></code></pre></div><p>Disable with:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">ufw disable
</span></span></code></pre></div><p>Extract the token to be used for joining worker nodes:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo cat /var/lib/rancher/k3s/server/node-token
</span></span></code></pre></div><p>
    <img src="/posts/install-k3s-on-ubuntu-server-22-04/20230415_5.png" alt="alt text">
  </p>
<h3 id="installation-on-worker-node">Installation on worker node</h3>
<p>Next is to install k3s on the worker nodes. Here you will need the master node IP address as well as the token from the previous step.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">curl -sfL http://get.k3s.io <span class="p">|</span> <span class="nv">K3S_URL</span><span class="o">=</span>https://&lt;master_IP&gt;:6443 <span class="nv">K3S_TOKEN</span><span class="o">=</span>&lt;join_token&gt; sh -s - --docker
</span></span></code></pre></div><p>
    <img src="/posts/install-k3s-on-ubuntu-server-22-04/20230415_6.png" alt="alt text">
  </p>
<p>Verify all nodes are joined to the cluster</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo kubectl get nodes -o wide
</span></span></code></pre></div><p>
    <img src="/posts/install-k3s-on-ubuntu-server-22-04/20230415_7.png" alt="alt text">
  </p>
<p>Now you can try to deploy a test nginx pod</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo kubectl run --image nginx nginx-test
</span></span><span class="line"><span class="cl">sudo kubectl get pod nginx-test -o wide
</span></span></code></pre></div><p>
    <img src="/posts/install-k3s-on-ubuntu-server-22-04/20230415_8.png" alt="alt text">
  </p>
<h3 id="permit-non-root-user-to-execute-kubectl-commands">Permit non-root user to execute kubectl commands</h3>
<p>Now if you try to execute kubectl commands without sudo, you would probably face the error below.</p>
<p>
    <img src="/posts/install-k3s-on-ubuntu-server-22-04/20230415_9.png" alt="alt text">
  </p>
<p>This is because kubernetes will be installed with root credentials and any other user to execute kubectl will have to be permitted. The easy way is to copy the k3s.yaml file in the /etc/rancher/k3s directory to your user’s kube config file. First create the directory (with your non-root user) if you don’t have it yet. Note of the user and group variables:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">mkdir ~/.kube
</span></span><span class="line"><span class="cl">cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
</span></span><span class="line"><span class="cl">chown &lt;user&gt;:&lt;group&gt; ~/.kube/config
</span></span></code></pre></div><p>Then you have to export the kube config every time so to do this automatically upon login modify your .bashrc and add the line:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">export</span> <span class="nv">KUBECONFIG</span><span class="o">=</span>~/.kube/config
</span></span></code></pre></div><p>For you to be able to execute kubectl commands with just typing ‘k’ you can also add the following:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">source</span> &lt;<span class="o">(</span>kubectl completion bash<span class="o">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">alias</span> <span class="nv">k</span><span class="o">=</span>kubectl
</span></span><span class="line"><span class="cl"><span class="nb">complete</span> -o default -F __start_kubectl k
</span></span></code></pre></div><p>Lastly if you want to be able to execute kubectl commands from a remote machine outside your cluster just ensure you have the same kube config file in the previous step and change the server IP from localhost to the actual one.</p>
<p>
    <img src="/posts/install-k3s-on-ubuntu-server-22-04/20230415_10.png" alt="alt text">
  </p>
<p>
    <img src="/posts/install-k3s-on-ubuntu-server-22-04/20230415_11.png" alt="alt text">
  </p>
]]></content:encoded>
    </item>
    
    <item>
      <title>Install Ubuntu Server 22.04 &amp;　GNS3 on Unraid</title>
      <link>https://luislogs.com/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/</link>
      <pubDate>Sat, 01 Apr 2023 18:40:30 +0900</pubDate>
      
      <guid>https://luislogs.com/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/</guid>
      <description>Unraid is a hypervisor by itself. So aside from just running docker containers, you can also spawn VMs. I wanted to install Ubuntu Server 22.04 so I could run the GNS3 remote server on it.
Ubuntu Server Installation You can download the Ubuntu iso image from this page. It’s either you download to your local machine or using Unraid with the help of the CLI or some docker app.
While waiting for the download to complete.</description>
      <content:encoded><![CDATA[<p>Unraid is a hypervisor by itself. So aside from just running docker containers, you can also spawn VMs. I wanted to install Ubuntu Server 22.04 so I could run the GNS3 remote server on it.</p>
<h3 id="ubuntu-server-installation">Ubuntu Server Installation</h3>
<p>You can download the Ubuntu iso image from this page. It’s either you download to your local machine or using Unraid with the help of the CLI or some docker app.</p>
<p>While waiting for the download to complete. Go to Settings &gt; VM Manager and set ‘Enable VMs’ to yes. You can also toggle the advanced view to have a more detailed look on the settings. Here you will see the directory of the iso files and the storage so be sure to have your shares properly configured.</p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_1.png" alt="alt text">
  </p>
<p>Just to give you an idea my iso directory is saved to a cache that doesn’t have redundancy. Image files that are not intended to be used any sooner can either be deleted or transferred to an archive directory on your main array.</p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_2.png" alt="alt text">
  </p>
<p>It is important to transfer the iso file to the iso share or else you won’t be able to select this later on.</p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_3.png" alt="alt text">
  </p>
<p>Go to VMs &gt; Add VM &gt; Ubuntu. Select the CPU cores and memory as well as the ISO file.</p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_4.png" alt="alt text">
  </p>
<p>Assign the disk size.</p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_5.png" alt="alt text">
  </p>
<p>For network model ensure that br0 is selected. For VM console port Unraid starts with the default port of VNC but just to avoid any conflict later on when you run appliances on GNS3 just choose a different port range from 5900. Uncheck ‘Start VM after creation’. Everything else can be kept in default. Create the VM.</p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_6.png" alt="alt text">
  </p>
<p><em>Note network-model should be set to virtio-net to avoid any networking issues with the docker containers.</em></p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_7.png" alt="alt text">
  </p>
<p>Go back and edit this VM and toggle from form to XML view on the upper right hand side. To enable nested virtualization insert the following line in the <cpu> part.</p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_8.png" alt="alt text">
  </p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-xml" data-lang="xml"><span class="line"><span class="cl"><span class="nt">&lt;feature</span> <span class="na">policy=</span><span class="s">&#39;require&#39;</span> <span class="na">name=</span><span class="s">&#39;vmx&#39;</span><span class="nt">/&gt;</span>
</span></span></code></pre></div><p>Update, start the VM, and open the console. Install the OS how you normally do it.</p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_9.png" alt="alt text">
  </p>
<p>As for me I always choose Ubuntu Server (not minimized) everytime to avoid any package dependencies later on.</p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_10.png" alt="alt text">
  </p>
<p>Be sure the VM is assigned a DHCP IP when you get to the network settings or assign a static one if you wish. I always prefer the latter.</p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_11.png" alt="alt text">
  </p>
<p>Modify disk to utilize all. There really is no use case to use LVM if you are just running GNS3 server.</p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_12.png" alt="alt text">
  </p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_13.png" alt="alt text">
  </p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_14.png" alt="alt text">
  </p>
<p>Also ensure OpenSSH to be installed!</p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_15.png" alt="alt text">
  </p>
<p>Reboot the server after installation and check your IP within the VNC console. Try to login via ssh.</p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_16.png" alt="alt text">
  </p>
<p>Perform basic checks especially the disk space! The root directory should be assigned the biggest chunk of the disk size.</p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_17.png" alt="alt text">
  </p>
<h3 id="install-gns3-server">Install GNS3 Server</h3>
<p>I am sharing the link to the official documentation here for reference. It says to execute the following commands as root:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo -i
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> /tmp
</span></span><span class="line"><span class="cl">curl https://raw.githubusercontent.com/GNS3/gns3-server/master/scripts/remote-install.sh &gt; gns3-remote-install.sh
</span></span><span class="line"><span class="cl">bash gns3-remote-install.sh --with-openvpn --with-iou --with-i386-repository
</span></span></code></pre></div><p>Now if we check the status of the gns3 services. It would always show it’s activating</p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_18.png" alt="alt text">
  </p>
<p>If you check the log file mentioned there you would see the following</p>
<blockquote>
<p>CRITICAL web_server.py:88 Could not start the server: [Errno 99] error while attempting to bind on address (‘172.16.253.1’, 3080): cannot assign requested address</p>
</blockquote>
<p>Let’s check the configuration file getting loaded and see if we can see anything there.</p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_19.png" alt="alt text">
  </p>
<p>The controller config file can be found in the highlighted path shown above. At the same time we can see GNS3 is trying to listen on 172.16.253.1.</p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_20.png" alt="alt text">
  </p>
<p>This seems to be the default IP configured in the installation. Change this to the local IP of your VM.</p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_21.png" alt="alt text">
  </p>
<p>Restart GNS3 and check the status again. It should be running now.</p>
<p>
    <img src="/posts/install-ubuntu-server-22-04-gns3-server-on-unraid/unraid_22.png" alt="alt text">
  </p>
<p>At this point you should be able to connect from a remote GNS3 GUI to this server.</p>
<p>Lastly to start GNS3 server automatically every reboot, just enable the service:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">systemctl <span class="nb">enable</span> gns3
</span></span></code></pre></div>]]></content:encoded>
    </item>
    
  </channel>
</rss>
