Friday, December 05, 2025

Make WSL use Rancher Desktop kubeconfig

 

✅ 1. First: Check the kubeconfig Rancher Desktop injects into Windows

Rancher Desktop ALWAYS writes a kubeconfig to this standard location:

👉 C:\Users\<your-user>\.kube\config

Check it:

PowerShell:

dir $HOME\.kube

If you see a file named config, then that is the correct kubeconfig.


eg: 

Directory: C:\Users\admin\.kube

Mode                 LastWriteTime         Length Name

----                 -------------         ------ ----

d-----        22/11/2024  10:12 AM                cache
-a----        06/12/2025   8:58 AM           6054 config



Inside WSL run:

mkdir -p ~/.kube ln -s /mnt/c/Users/admin/.kube/config ~/.kube/config

Now WSL and PowerShell use the same Kubernetes context.


Create aliases for convenience

Inside WSL, so you don’t have to type .exe:

echo "alias kubectl='kubectl.exe'" >> ~/.bashrc echo "alias helm='helm.exe'" >> ~/.bashrc source ~/.bashrc

Now in WSL you can run:

kubectl get nodes helm list -A

Exactly like in PowerShell.


Friday, August 08, 2025

Push containe to GHCR


Command for push to GHCR

1. Log in to GHCR

Use Docker CLI to authenticate to GitHub Container Registry:


echo YOUR_GITHUB_PERSONAL_ACCESS_TOKEN | docker login ghcr.io -u YOUR_GITHUB_USERNAME --password-stdin

 

Make sure your PAT (Personal Access Token) has the write:packages and read:packages scopes.


2. Tag your Docker image

Assuming your image is named my-app:latest, tag it for GHCR:


docker tag my-app:latest ghcr.io/YOUR_GITHUB_USERNAME/my-app:latest


Replace YOUR_GITHUB_USERNAME with your actual GitHub username (or org name).

You can also add versions/tags as needed.


3. Push the image

Push the tagged image to GHCR:


docker push ghcr.io/YOUR_GITHUB_USERNAME/my-app:latest


4. Verify on GitHub

Go to your GitHub profile or organization, then:

  • Navigate to Packages.

  • You should see your pushed Docker image there.

Wednesday, January 15, 2025

Docker error : The network name cannot be found.

 If u get this error

deploying WSL2 distributions ensuring main distro is deployed: checking if main distro is up to date: checking main distro bootstrap version: getting main distro bootstrap version: open \\wsl$\docker-desktop\etc\wsl_bootstrap_version: The network name cannot be found. checking if isocache exists: CreateFile \\wsl$\docker-desktop-data\isocache\: The network name cannot be found.

 

Try the following to troubleshoot:

  1. Stop Docker Desktop
  2. Run the following command in your terminal wsl --unregister docker-desktop
  3. Run Docker Desktop again (Will recreate the distro)

Note: I also start my Docker Desktop as Administrator each time, so you probably need to run your terminal/Powershell as Administrator like I did.

Thursday, November 21, 2024

Enable ingress

https://blog.raulnq.com/testing-the-nginx-ingress-controller-locally-docker-desktop

 

helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm install nginx-ingress ingress-nginx/ingress-nginx

Run kubectl get ingressclass and kubectl get services to check the installation:

First Deployment 

kubectl create deployment web --image=gcr.io/google-samples/hello-app:1.0

kubectl expose deployment web --type=NodePort --port=8080 

 

Second Deployment  

kubectl create deployment web2 --image=gcr.io/google-samples/hello-app:2.0
kubectl expose deployment web2 --port=8080 --type=NodePort
 

 

 


apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
spec:
  ingressClassName: nginx
  rules:
    - host: hello-world.example
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: web
                port:
                  number: 8080
                  
          - path: /v2
            pathType: Prefix
            backend:
              service:
                name: web2
                port:
                  number: 8080
                  
          - path: /v3
            pathType: Prefix
            backend:
              service:
                name: web
                port:
                  number: 8080

kubectl apply -f example-ingress.yaml 

kubectl get ingress

Monday, October 14, 2024

minikube up cluster

 

Start your cluster

 

 

minikube start
 
kubectl get po -A
minikube kubectl -- get po -A
 
minikube dashboard
start kube 
kubectl create deployment hello-minikube --image=kicbase/echo-server:1.0
kubectl expose deployment hello-minikube --type=NodePort --port=8080
 
kubectl get services hello-minikube
minikube service hello-minikube
kubectl port-forward service/hello-minikube 7080:8080


 

 
 

Sunday, January 16, 2022

Install swoole on window

 

Not directly, but with Docker and WSL (Windows Subsystem for Linux).

  1. Install Docker (https://www.docker.com/products/docker-desktop)
  2. Setup WSL

Open PowerShell as Administrator and run

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Updating/Install the WSL 2 Linux kernel (https://docs.microsoft.com/en-us/windows/wsl/wsl2-kernel)

  1. Enable "Enable the experimental WSL 2 based engine" in Docker (General)
  2. Build the Docker container

IMPORTANT! Don't use a path with spacebars like:

  • C:\Users\ {FIRSTNAME}[SPACEBAR]{LASTNAME}\Desktop\docker)

Create a folder (D:\docker) and create with an Editor the Dockerfile (D:\docker\Dockerfile)

FROM php:7.4.2-cli

RUN apt-get update && apt-get install vim -y && \
    apt-get install openssl -y && \
    apt-get install libssl-dev -y && \
    apt-get install wget -y && \
    apt-get install git -y && \
    apt-get install procps -y && \
    apt-get install htop -y

RUN cd /tmp && git clone https://github.com/swoole/swoole-src.git && \
    cd swoole-src && \
    git checkout v4.4.15 && \
    phpize  && \
    ./configure  --enable-openssl && \
    make && make install

RUN touch /usr/local/etc/php/conf.d/swoole.ini && \
    echo 'extension=swoole.so' > /usr/local/etc/php/conf.d/swoole.ini

RUN wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_amd64
RUN chmod +x /usr/local/bin/dumb-init

RUN apt-get autoremove -y && rm -rf /var/lib/apt/lists/*

ENTRYPOINT ["/usr/local/bin/dumb-init", "--", "php"]

Open PowerShell navigate to your folder (D:\docker) to build the DockerImage

docker build -f ./Dockerfile -t swoole-php .
  1. Add your swoole source code

As an example (D:\docker\server.php)

<?php
$http = new Swoole\HTTP\Server("0.0.0.0", 9501);

$http->on('start', function ($server) {
    echo "Swoole http server is started at http://127.0.0.1:9501\n";
});

$http->on('request', function ($request, $response) {
    $response->header("Content-Type", "text/plain");
    $response->end("Hello World\n");
});

$http->start();
?>
  1. Start your swoole http server with the PowerShell
docker run --rm -p 9501:9501 -v D:/docker/:/app -w /app swoole-php server.php

Monday, March 02, 2020

Gradle does not have execution permission.

How to solve the problem

run this command in flutter android directory

chmod a+rx gradlew