<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="/feed.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2025-05-30T19:50:26+00:00</updated><id>/feed.xml</id><title type="html">domikini-dev-blog</title><subtitle>Domikini Github Developer Blog</subtitle><author><name>domikini</name><email>domikini@gmail.com</email></author><entry><title type="html">Fix Kubernetes Metrics Server Deployed On Kubernetes</title><link href="/Fix-kubernetes-metrics-server-deployed-on-Kubernetes" rel="alternate" type="text/html" title="Fix Kubernetes Metrics Server Deployed On Kubernetes" /><published>2022-03-12T00:00:00+00:00</published><updated>2022-03-12T00:00:00+00:00</updated><id>/Fix-kubernetes-metrics-server-deployed-on-Kubernetes</id><content type="html" xml:base="/Fix-kubernetes-metrics-server-deployed-on-Kubernetes"><![CDATA[<p>Om Kubernetes metrics deployment fallerar så kan det bero på en liten konfiguration som saknas i args. Lägg till detta i args under deployment. Kör <code class="language-plaintext highlighter-rouge">kubectl edit deployments &lt;namn-på-metrics-deployment&gt;</code>.</p>

<p>Lägg till:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>spec:
containers:
- args:
- --secure-port=4443
- --cert-dir=/tmp
command:
- /metrics-server
- --kubelet-insecure-tls
- --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
- --kubelet-use-node-status-port
- --metric-resolution=15s
image: k8s.gcr.io/metrics-server/metrics-server:v0.6.1
imagePullPolicy: IfNotPresent
</code></pre></div></div>]]></content><author><name>domikini</name><email>domikini@gmail.com</email></author><summary type="html"><![CDATA[Om Kubernetes metrics deployment fallerar så kan det bero på en liten konfiguration som saknas i args. Lägg till detta i args under deployment. Kör kubectl edit deployments &lt;namn-på-metrics-deployment&gt;.]]></summary></entry><entry><title type="html">Install Elasticsearch Fluentd Kibana On Kubernetes</title><link href="/Install-elasticsearch-fluentd-kibana-on-Kubernetes" rel="alternate" type="text/html" title="Install Elasticsearch Fluentd Kibana On Kubernetes" /><published>2022-03-12T00:00:00+00:00</published><updated>2022-03-12T00:00:00+00:00</updated><id>/Install-elasticsearch-fluentd-kibana-on-Kubernetes</id><content type="html" xml:base="/Install-elasticsearch-fluentd-kibana-on-Kubernetes"><![CDATA[<p>#Install Elasticsearch, Fluentd and Kibana on Kubernetes Cluster</p>
<ol>
  <li>Denna guide har en utmärkt beskrivning på hur en Elasticsearch, Fluentd och Kibana installeras på Kubernetes kluster. https://kamrul.dev/deploy-efk-stack-with-helm-3-in-kubernetes/</li>
</ol>]]></content><author><name>domikini</name><email>domikini@gmail.com</email></author><summary type="html"><![CDATA[#Install Elasticsearch, Fluentd and Kibana on Kubernetes Cluster Denna guide har en utmärkt beskrivning på hur en Elasticsearch, Fluentd och Kibana installeras på Kubernetes kluster. https://kamrul.dev/deploy-efk-stack-with-helm-3-in-kubernetes/]]></summary></entry><entry><title type="html">Install Kubernetes On Ubuntu 18.04.6 Lts</title><link href="/Install-Kubernetes-on-Ubuntu-18.04.6-LTS" rel="alternate" type="text/html" title="Install Kubernetes On Ubuntu 18.04.6 Lts" /><published>2021-11-05T00:00:00+00:00</published><updated>2021-11-05T00:00:00+00:00</updated><id>/Install-Kubernetes-on-Ubuntu-18.04.6-LTS</id><content type="html" xml:base="/Install-Kubernetes-on-Ubuntu-18.04.6-LTS"><![CDATA[<p>#Install Kubernetes on Ubuntu 18.04.6 LTS</p>
<ol>
  <li>Spinn upp tre Linux servrar t.ex. som Virtual Machines på VirtualBox. Kör på Ubuntu 18.04.6 LTS (Bionic Beaver). Om möjligt kör på 4 vCPU, 8 GiB RAM, 30 GiB HDD på varje VM.</li>
  <li>Uppdatera Ubuntu servrarna: <code class="language-plaintext highlighter-rouge">sudo apt update –y &amp;&amp; sudo apt upgrade –y</code></li>
  <li>Installera vim och curl: <code class="language-plaintext highlighter-rouge">sudo apt install vim curl –y</code></li>
  <li>Installera docker:
    <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> sudo apt install docker.io -y
 sudo systemctl enable docker.service
 sudo usermod -aG docker $USER
</code></pre></div>    </div>
  </li>
  <li>Fixa cgroups problem &gt;1.22
    <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo cat &lt;&lt; EOF | sudo tee /etc/docker/daemon.json
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
EOF
</code></pre></div>    </div>
  </li>
  <li>
    <p>Lägg till repot för Kubernetes:</p>

    <p><code class="language-plaintext highlighter-rouge">echo 'deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main' | sudo tee -a /etc/apt/sources.list.d/kubernetes.list</code></p>
  </li>
  <li>
    <p>Ladda ned Google Cloud publika nyckel:</p>

    <p><code class="language-plaintext highlighter-rouge">sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg</code></p>
  </li>
  <li>
    <p>Installera kubernetes:</p>

    <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo apt update –y
sudo apt installkubeadm=1.21.1-00 kubelet=1.21.1-00 kubectl=1.21.1-00 –y
sudo apt-mark hold kubelet kubeadm kubectl
</code></pre></div>    </div>
  </li>
  <li>
    <p>Inaktivera swap temporärt:</p>

    <p><code class="language-plaintext highlighter-rouge">sudo swapoff –a</code></p>
  </li>
  <li>Lägg till ip och hostname i filen /etc/hosts</li>
</ol>

<p><code class="language-plaintext highlighter-rouge">&lt;ip-till-nod&gt; &lt;hostname&gt;</code> t.ex. <code class="language-plaintext highlighter-rouge">10.128.0.3 k8scp</code></p>

<ol>
  <li>Skapa en kubeadm-config.yaml fil och lägg till följande i filen:</li>
</ol>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>   apiVersion: kubeadm.k8s.io/v1beta2
   kind: ClusterConfiguration
   kubernetesVersion: 1.21.1   #&lt;-- Use the word stable for newest version
   controlPlaneEndpoint: "k8scp:6443"   #&lt;-- Use the node alias not the IP
   networking:
     podSubnet: 192.168.0.0/16   #&lt;-- Match the IP range from the Calico config file 
</code></pre></div></div>]]></content><author><name>domikini</name><email>domikini@gmail.com</email></author><summary type="html"><![CDATA[#Install Kubernetes on Ubuntu 18.04.6 LTS Spinn upp tre Linux servrar t.ex. som Virtual Machines på VirtualBox. Kör på Ubuntu 18.04.6 LTS (Bionic Beaver). Om möjligt kör på 4 vCPU, 8 GiB RAM, 30 GiB HDD på varje VM. Uppdatera Ubuntu servrarna: sudo apt update –y &amp;&amp; sudo apt upgrade –y Installera vim och curl: sudo apt install vim curl –y Installera docker: sudo apt install docker.io -y sudo systemctl enable docker.service sudo usermod -aG docker $USER]]></summary></entry><entry><title type="html">Use Find Command To Delete Old Logs</title><link href="/Use-find-command-to-delete-old-logs" rel="alternate" type="text/html" title="Use Find Command To Delete Old Logs" /><published>2021-09-25T00:00:00+00:00</published><updated>2021-09-25T00:00:00+00:00</updated><id>/Use-find-command-to-delete-old-logs</id><content type="html" xml:base="/Use-find-command-to-delete-old-logs"><![CDATA[<h2 id="the-varlog-folder-usually-will-become-filled-up-with-old-log-files-from-logrotate-here-is-a-way-with-find-command-to-clean-and-delete-those">The /var/log/ folder usually will become filled up with old log files from logrotate. Here is a way with find command to clean and delete those.</h2>

<p>Delete all files:</p>

<p><code class="language-plaintext highlighter-rouge">find /var/log -type f -delete</code></p>

<p>Delete all .gz and rotated file</p>

<p><code class="language-plaintext highlighter-rouge">find /var/log -type f -regex ".*\.gz$"</code>
<code class="language-plaintext highlighter-rouge">find /var/log -type f -regex ".*\.[0-9]$"</code></p>

<p>Try run command without “-delete”, to test it.</p>]]></content><author><name>domikini</name><email>domikini@gmail.com</email></author><summary type="html"><![CDATA[The /var/log/ folder usually will become filled up with old log files from logrotate. Here is a way with find command to clean and delete those.]]></summary></entry><entry><title type="html">Mongodb Setup With Docker Compose And Setup Authentication</title><link href="/MongoDB-setup-with-docker-compose-and-setup-authentication" rel="alternate" type="text/html" title="Mongodb Setup With Docker Compose And Setup Authentication" /><published>2021-01-13T00:00:00+00:00</published><updated>2021-01-13T00:00:00+00:00</updated><id>/MongoDB-setup-with-docker-compose-and-setup-authentication</id><content type="html" xml:base="/MongoDB-setup-with-docker-compose-and-setup-authentication"><![CDATA[<h2 id="reference-httpsdevtoefe136how-to-enable-mongodb-authentication-with-docker-compose-2nbp">Reference: https://dev.to/efe136/how-to-enable-mongodb-authentication-with-docker-compose-2nbp</h2>

<p>By default there is no authentication in MongoDB. It means that it comes with empty authentication. So we should create users and roles manually. There are lots of ways to create MongoDB docker-compose with authentication. The most popular one of them is to write a bash script with user and roles then use it in docker-compose and another way is to create an init-mongodb.js file with users and roles and use it in docker-compose. But in this post, I will show you how you could create MongoDB docker-compose and then add users and roles manually. Lets start…</p>

<p>Run MongoDB docker-compose without authentication
First of all we should run MongoDB <code class="language-plaintext highlighter-rouge">docker-compose</code> without auth. Using <code class="language-plaintext highlighter-rouge">docker-compose up -d</code> we could run it.</p>

<p><img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yezN4R8G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/uqd2xlbe7m5mmzlglebp.png" alt="" /></p>

<p>Connect MongoDB without auth inside container
For doing that firstly we should run <code class="language-plaintext highlighter-rouge">docker exec -it mongodb bash</code> and enter inside the container. Then simply run <code class="language-plaintext highlighter-rouge">mongo</code> command to connect to mongodb.</p>

<p>Create user and roles for our MongoDB
Firstly we will create admin user with username root and password root in admin database.</p>

<p><img src="https://res.cloudinary.com/practicaldev/image/fetch/s--M6-Mj7_n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/yvuxdragqm624yqrwj3n.png" alt="" /></p>

<p>Then we need to create other user. Here I will create a demo user within demo database for our MongoDB:</p>

<p><img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8JH0ACXd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ac3bqz221coi4t74x1w3.png" alt="" /></p>

<p>Now we are ready to run MongoDB with auth.</p>

<p>Enable MongoDB auth in docker-compose
In order to enable auth in MongoDB we will use <code class="language-plaintext highlighter-rouge">--auth</code> flag in docker-compose. After that we could use <code class="language-plaintext highlighter-rouge">docker-compose up -d</code> command again, to run MongoDB container.</p>

<p><img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FpCDa7qX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/u8e1j6l02m570wrsm4nw.png" alt="" /></p>

<p>Connect MongoDB with defined authentication
In this step we can connect our db with defined authentication. Firstly again we need to run docker exec -it mongodb bash command in order to enter inside the container. Now we are in so we can connect our db. Here I write 2 command one of them is to connect admin db and another one is to connect demo db.</p>

<p><code class="language-plaintext highlighter-rouge">mongo -u root -p root --authenticationDatabase admin</code></p>

<p><code class="language-plaintext highlighter-rouge">mongo -u demo -p demo12345 --authenticationDatabase demo</code></p>]]></content><author><name>domikini</name><email>domikini@gmail.com</email></author><summary type="html"><![CDATA[Reference: https://dev.to/efe136/how-to-enable-mongodb-authentication-with-docker-compose-2nbp]]></summary></entry><entry><title type="html">Create Multiarch Docker Buildx Builder</title><link href="/Create-multiarch-docker-buildx-builder" rel="alternate" type="text/html" title="Create Multiarch Docker Buildx Builder" /><published>2020-11-11T00:00:00+00:00</published><updated>2020-11-11T00:00:00+00:00</updated><id>/Create-multiarch-docker-buildx-builder</id><content type="html" xml:base="/Create-multiarch-docker-buildx-builder"><![CDATA[<h2 id="create-a-multiarch-docker-buildx-builder">Create a multiarch Docker Buildx builder</h2>

<p>Run the following commands:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx rm builder
docker buildx create --name builder --driver docker-container --use
docker buildx inspect --bootstrap
</code></pre></div></div>
<p>Inspect the builder by using the command:</p>

<p><code class="language-plaintext highlighter-rouge">docker buildx ls</code></p>

<p>Remove builder:
<code class="language-plaintext highlighter-rouge">docker buildx rm builder</code></p>]]></content><author><name>domikini</name><email>domikini@gmail.com</email></author><summary type="html"><![CDATA[Create a multiarch Docker Buildx builder]]></summary></entry><entry><title type="html">Make A Git Sync Container For Arm</title><link href="/Make-a-git-sync-container-for-ARM" rel="alternate" type="text/html" title="Make A Git Sync Container For Arm" /><published>2020-11-11T00:00:00+00:00</published><updated>2020-11-11T00:00:00+00:00</updated><id>/Make-a-git-sync-container-for-ARM</id><content type="html" xml:base="/Make-a-git-sync-container-for-ARM"><![CDATA[<h2 id="make-a-git-sync-container-for-arm-architecture">Make a git-sync container for ARM architecture</h2>

<p>Download git-sync repo
<code class="language-plaintext highlighter-rouge">git clone https://github.com/kubernetes/git-sync.git</code></p>

<p>Make sure you have buildx installed. If not, use the following steps:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>export DOCKER_BUILDKIT=1
docker build --platform=local -o . git://github.com/docker/buildx
mkdir -p ~/.docker/cli-plugins
mv buildx ~/.docker/cli-plugins/docker-buildx
</code></pre></div></div>

<p>Make sure you have a multiarch bulder. Follow the guide 2020-11-11-Create-multiarch-docker-buildx-builder.</p>

<p>Go to the git-sync folder. Type the following to start the build process.
<code class="language-plaintext highlighter-rouge">make container REGISTRY=registry VERSION=tag GOOS=linux GOARCH=arm</code></p>]]></content><author><name>domikini</name><email>domikini@gmail.com</email></author><summary type="html"><![CDATA[Make a git-sync container for ARM architecture]]></summary></entry><entry><title type="html">Fixing Let’s Encrypt Auto Renewal On Asus Merlin Router</title><link href="/Fixing-let's-encrypt-auto-renewal-on-ASUS-Merlin-router" rel="alternate" type="text/html" title="Fixing Let’s Encrypt Auto Renewal On Asus Merlin Router" /><published>2020-04-05T00:00:00+00:00</published><updated>2020-04-05T00:00:00+00:00</updated><id>/Fixing-let&apos;s-encrypt-auto-renewal-on-ASUS-Merlin-router</id><content type="html" xml:base="/Fixing-let&apos;s-encrypt-auto-renewal-on-ASUS-Merlin-router"><![CDATA[<h2 id="reference-httpswwwsnbforumscomthreadsletsencrypt-cert-stopped-updating62715">Reference: https://www.snbforums.com/threads/letsencrypt-cert-stopped-updating.62715/</h2>

<p>Connect to your router via ssh, delete your /jffs/.le folder and execute service restart_letsencrypt command. Allow a minute for the task to complete.</p>

<p>Looks like the same problem described in this thread: Lets Encrypt not updating, or? (https://www.snbforums.com/threads/lets-encrypt-not-updating-or.59524/)</p>]]></content><author><name>domikini</name><email>domikini@gmail.com</email></author><summary type="html"><![CDATA[Reference: https://www.snbforums.com/threads/letsencrypt-cert-stopped-updating.62715/]]></summary></entry><entry><title type="html">Centos Rhel 7 How To Make Custom Script To Run Automatically During Boot As A Systemd Service</title><link href="/Centos-rhel-7-how-to-make-custom-script-to-run-automatically-during-boot-as-a-systemd-service" rel="alternate" type="text/html" title="Centos Rhel 7 How To Make Custom Script To Run Automatically During Boot As A Systemd Service" /><published>2020-03-30T00:00:00+00:00</published><updated>2020-03-30T00:00:00+00:00</updated><id>/Centos-rhel-7-how-to-make-custom-script-to-run-automatically-during-boot-as-a-systemd-service</id><content type="html" xml:base="/Centos-rhel-7-how-to-make-custom-script-to-run-automatically-during-boot-as-a-systemd-service"><![CDATA[<h1 id="centos--rhel-7--how-to-create-custom-script-to-run-automatically-during-boot-as-a-systemd-service">CentOS / RHEL 7 : How to create custom script to run automatically during boot as a systemd service</h1>
<p>Reference: https://www.thegeekdiary.com/centos-rhel-7-how-to-make-custom-script-to-run-automatically-during-boot/</p>

<p>In RHEL 5 and 6, we were using automatic startup feature of RHEL through /etc/rc.d/init.d to run any script at system boot. Starting with RHEL 7 init is replaced by systemd and the prior method is now deprecated. There is another way in RHEL 7 to do the same.</p>

<h2 id="creating-the-custom-script">Creating the custom script</h2>
<ol>
  <li>
    <p>Let us first create a sample custom script to be run at system boot automatically.</p>

    <p><code class="language-plaintext highlighter-rouge">vi /var/tmp/test_script.sh</code></p>

    <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> #!/bin/bash
 echo "This is a sample script to test auto run during boot" &gt; /var/tmp/script.out
 echo "The time the script run was --&gt;  `date`" &gt;&gt; /var/tmp/script.out
</code></pre></div>    </div>
  </li>
  <li>
    <p>Check and verify the file permission.</p>

    <p><code class="language-plaintext highlighter-rouge">ls -lrt /usr/local/sbin/myscript.sh</code></p>
  </li>
  <li>
    <p>Add execute permission(if it’s not already set).</p>

    <p><code class="language-plaintext highlighter-rouge">chmod +x /var/tmp/test_script.sh</code></p>
  </li>
</ol>

<h2 id="creating-new-systemd-service-unit">Creating new systemd service unit</h2>
<p>Create a new service unit file at /etc/systemd/system/sample.service with below content. The name of the service unit is user defined and can be any name of your choice.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>`vi /etc/systemd/system/sample.service`


[Unit]
Description=Description for sample script goes here
After=network.target

[Service]
Type=simple
ExecStart=/var/tmp/test_script.sh
TimeoutStartSec=0

[Install]
WantedBy=default.target
</code></pre></div></div>

<p>After= : If the script needs any other system facilities (networking, etc), modify the [Unit] section to include appropriate After=, Wants=, or Requires= directives.
Type= : Switch Type=simple for Type=idle in the [Service] section to delay execution of the script until all other jobs are dispatched
WantedBy= : target to run the sample script in</p>

<h2 id="enable-the-systemd-service-unit">Enable the systemd service unit</h2>

<ol>
  <li>
    <p>Reload the systemd process to consider newly created sample.service OR every time when sample.service gets modified.</p>

    <p><code class="language-plaintext highlighter-rouge">systemctl daemon-reload</code></p>
  </li>
  <li>
    <p>Enable this service to start after reboot automatically.</p>

    <p><code class="language-plaintext highlighter-rouge">systemctl enable sample.service</code></p>
  </li>
  <li>
    <p>Start the service.</p>

    <p><code class="language-plaintext highlighter-rouge">systemctl start sample.service</code></p>
  </li>
  <li>
    <p>Reboot the host to verify whether the scripts are starting as expected during system boot.</p>

    <p><code class="language-plaintext highlighter-rouge">systemctl reboot</code></p>
  </li>
</ol>]]></content><author><name>domikini</name><email>domikini@gmail.com</email></author><summary type="html"><![CDATA[CentOS / RHEL 7 : How to create custom script to run automatically during boot as a systemd service Reference: https://www.thegeekdiary.com/centos-rhel-7-how-to-make-custom-script-to-run-automatically-during-boot/]]></summary></entry><entry><title type="html">Eshoponcontainers Project Microservices</title><link href="/eShopOnContainers-project-microservices" rel="alternate" type="text/html" title="Eshoponcontainers Project Microservices" /><published>2020-03-29T00:00:00+00:00</published><updated>2020-03-29T00:00:00+00:00</updated><id>/eShopOnContainers-project-microservices</id><content type="html" xml:base="/eShopOnContainers-project-microservices"><![CDATA[<h1 id="cross-platform-net-sample-microservices-and-container-based-application">Cross-platform .NET sample microservices and container based application</h1>
<p>Deployment on Windows platform</p>
<ul>
  <li>https://github.com/dotnet-architecture/eShopOnContainers</li>
  <li>https://github.com/dotnet-architecture/eShopOnContainers/wiki/Windows-setup</li>
</ul>

<h2 id="resolve-issue-on-login-related-to-cors-rules">Resolve issue on login related to CORS rules</h2>
<p>Use url http://docker.for.win.localhost:5100/ instead of http://localhost:5100</p>

<ul>
  <li>https://github.com/dotnet-architecture/eShopOnContainers/issues/673</li>
</ul>]]></content><author><name>domikini</name><email>domikini@gmail.com</email></author><summary type="html"><![CDATA[Cross-platform .NET sample microservices and container based application Deployment on Windows platform https://github.com/dotnet-architecture/eShopOnContainers https://github.com/dotnet-architecture/eShopOnContainers/wiki/Windows-setup]]></summary></entry></feed>