kubernetes1

post subtitle

By widehyo

install tools(wsl)

minikube

curl -LO https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube && rm minikube-linux-amd64
 ~ $ curl -LO https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-amd64
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  128M  100  128M    0     0  10.3M      0  0:00:12  0:00:12 --:--:-- 11.5M
 ~ $ sudo install minikube-linux-amd64 /usr/local/bin/minikube && rm minikube-linux-amd64
[sudo] password for widehyo: 

 ~ $ minikube start
😄  minikube v1.38.1 on Ubuntu 22.04 (kvm/amd64)
✨  Automatically selected the docker driver. Other choices: ssh, none
❗  Starting v1.39.0, minikube will default to "containerd" container runtime. See #21973 for more info.
📌  Using Docker driver with root privileges
👍  Starting "minikube" primary control-plane node in "minikube" cluster
🚜  Pulling base image v0.0.50 ...
💾  Downloading Kubernetes v1.35.1 preload ...
    > gcr.io/k8s-minikube/kicbase...:  519.58 MiB / 519.58 MiB  100.00% 8.93 Mi
    > preloaded-images-k8s-v18-v1...:  272.45 MiB / 272.45 MiB  100.00% 4.18 Mi
🔥  Creating docker container (CPUs=2, Memory=3072MB) ...
🐳  Preparing Kubernetes v1.35.1 on Docker 29.2.1 ...
🔗  Configuring bridge CNI (Container Networking Interface) ...
🔎  Verifying Kubernetes components...
    ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🌟  Enabled addons: storage-provisioner, default-storageclass
💡  kubectl not found. If you need it, try: 'minikube kubectl -- get pods -A'
🏄  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

 ~ $ minikube status
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured

 ~ $ minikube kubectl -- get pods -A
    > kubectl.sha256:  64 B / 64 B [-------------------------] 100.00% ? p/s 0s
    > kubectl:  55.88 MiB / 55.88 MiB [-------------] 100.00% 7.00 MiB p/s 8.2s
NAMESPACE     NAME                               READY   STATUS    RESTARTS        AGE
kube-system   coredns-7d764666f9-x76mv           1/1     Running   0               2m47s
kube-system   etcd-minikube                      1/1     Running   0               2m53s
kube-system   kube-apiserver-minikube            1/1     Running   0               2m52s
kube-system   kube-controller-manager-minikube   1/1     Running   0               2m52s
kube-system   kube-proxy-bz8np                   1/1     Running   0               2m47s
kube-system   kube-scheduler-minikube            1/1     Running   0               2m53s
kube-system   storage-provisioner                1/1     Running   1 (2m15s ago)   2m51s

 ~ $ minikube kubectl get node
NAME       STATUS   ROLES           AGE     VERSION
minikube   Ready    control-plane   8m33s   v1.35.1
 ~ $ minikube kubectl cluster-info
Kubernetes control plane is running at https://127.0.0.1:32771
CoreDNS is running at https://127.0.0.1:32771/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.


 ~ $ minikube kubectl -- run hello-world --image=hello-world -it --restart=Never

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

 ~ $ minikube kubectl -- get po -A
NAMESPACE     NAME                               READY   STATUS      RESTARTS      AGE
default       hello-world                        0/1     Completed   0             41s
kube-system   coredns-7d764666f9-x76mv           1/1     Running     0             11m
kube-system   etcd-minikube                      1/1     Running     0             11m
kube-system   kube-apiserver-minikube            1/1     Running     0             11m
kube-system   kube-controller-manager-minikube   1/1     Running     0             11m
kube-system   kube-proxy-bz8np                   1/1     Running     0             11m
kube-system   kube-scheduler-minikube            1/1     Running     0             11m
kube-system   storage-provisioner                1/1     Running     1 (10m ago)   11m

 ~ $ minikube kubectl -- run hello-world --image=hello-world -it --restart=Never
Error from server (AlreadyExists): pods "hello-world" already exists
alias miku='minikube kubectl'
 ~ $ miku get pod
NAME          READY   STATUS      RESTARTS   AGE
hello-world   0/1     Completed   0          2m58s

 ~ $ miku delete pod hello-world
pod "hello-world" deleted from default namespace

 ~ $ miku -- run hello-world --image=hello-world -it --restart=Never --rm

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

pod "hello-world" deleted from default namespace

 ~ $ miku -- run hello-world --image=hello-world -it --restart=Never

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

 ~ $ miku -- logs hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

 ~ $ miku -- run hello-world --image=hello-world
Error from server (AlreadyExists): pods "hello-world" already exists
 ~ $ miku delete pod hello-world
pod "hello-world" deleted from default namespace
 ~ $ miku -- run hello-world --image=hello-world
pod/hello-world created

 ~ $ miku get all
NAME              READY   STATUS      RESTARTS      AGE
pod/hello-world   0/1     Completed   2 (21s ago)   26s

NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   18m

 ~ $ miku -- get rs -A
NAMESPACE     NAME                 DESIRED   CURRENT   READY   AGE
kube-system   coredns-7d764666f9   1         1         1       21m

 ~ $ miku -- get deployment -A
NAMESPACE     NAME      READY   UP-TO-DATE   AVAILABLE   AGE
kube-system   coredns   1/1     1            1           21m

 ~ $ miku -- delete pod hello-world
pod "hello-world" deleted from default namespace


 ~ $ miku -- run webserver --image=nginx
pod/webserver created
 ~ $ miku -- get po
NAME        READY   STATUS              RESTARTS   AGE
webserver   0/1     ContainerCreating   0          8s
 ~ $ miku -- get po
NAME        READY   STATUS              RESTARTS   AGE
webserver   0/1     ContainerCreating   0          11s
 ~ $ miku -- get po
NAME        READY   STATUS    RESTARTS   AGE
webserver   1/1     Running   0          16s

 ~ $ miku -- delete pod webserver
pod "webserver" deleted from default namespace

 ~ $ miku -- create deployment --image=nginx webserver
deployment.apps/webserver created
 ~ $ miku -- get deployment
NAME        READY   UP-TO-DATE   AVAILABLE   AGE
webserver   1/1     1            1           9s
 ~ $ miku -- scale --replicas=5 deployment/webserver
deployment.apps/webserver scaled
 ~ $ miku -- get po
NAME                         READY   STATUS              RESTARTS   AGE
webserver-654d95bc54-5kkrm   1/1     Running             0          8s
webserver-654d95bc54-cr9rm   1/1     Running             0          42s
webserver-654d95bc54-g8vnt   0/1     ContainerCreating   0          8s
webserver-654d95bc54-hr2gg   1/1     Running             0          8s
webserver-654d95bc54-lw6zd   1/1     Running             0          8s
 ~ $ miku -- get po
NAME                         READY   STATUS    RESTARTS   AGE
webserver-654d95bc54-5kkrm   1/1     Running   0          13s
webserver-654d95bc54-cr9rm   1/1     Running   0          47s
webserver-654d95bc54-g8vnt   1/1     Running   0          13s
webserver-654d95bc54-hr2gg   1/1     Running   0          13s
webserver-654d95bc54-lw6zd   1/1     Running   0          13s

 ~ $ miku get deploy,po
NAME                        READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/webserver   5/5     5            5           68s

NAME                             READY   STATUS    RESTARTS   AGE
pod/webserver-654d95bc54-5kkrm   1/1     Running   0          34s
pod/webserver-654d95bc54-cr9rm   1/1     Running   0          68s
pod/webserver-654d95bc54-g8vnt   1/1     Running   0          34s
pod/webserver-654d95bc54-hr2gg   1/1     Running   0          34s
pod/webserver-654d95bc54-lw6zd   1/1     Running   0          34s

 ~ $ ip --br link
lo               UNKNOWN        00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP> 
eth0             UP             00:15:5d:6f:17:ae <BROADCAST,MULTICAST,UP,LOWER_UP> 
ovs-system       DOWN           0e:9c:f9:7c:61:2e <BROADCAST,MULTICAST> 
OVS-1            DOWN           86:7b:4a:8f:bc:4b <BROADCAST,MULTICAST> 
lxcbr0           DOWN           00:16:3e:00:00:00 <NO-CARRIER,BROADCAST,MULTICAST,UP> 
br-51d8f0e2475d  UP             62:e7:65:9a:17:fe <BROADCAST,MULTICAST,UP,LOWER_UP> 
br-a9824bf3a475  DOWN           9e:fa:b6:bd:f8:bf <NO-CARRIER,BROADCAST,MULTICAST,UP> 
docker0          DOWN           fe:db:b9:89:df:a1 <NO-CARRIER,BROADCAST,MULTICAST,UP> 
veth34edb15@if2  UP             22:d2:7b:f5:a8:5e <BROADCAST,MULTICAST,UP,LOWER_UP> 
veth034fd2f@if2  UP             66:2f:a2:4a:46:12 <BROADCAST,MULTICAST,UP,LOWER_UP> 
vethdbab126@if2  UP             6e:9e:3f:7f:04:1d <BROADCAST,MULTICAST,UP,LOWER_UP> 
vethc7f4818@if2  UP             96:69:e9:91:bf:fa <BROADCAST,MULTICAST,UP,LOWER_UP> 
veth13b4293@if2  UP             ae:76:28:fd:f6:55 <BROADCAST,MULTICAST,UP,LOWER_UP> 
br-b2089135249d  UP             2e:76:de:65:14:bd <BROADCAST,MULTICAST,UP,LOWER_UP> 
vethff44889@if2  UP             ce:29:4f:f0:ff:a2 <BROADCAST,MULTICAST,UP,LOWER_UP> 
 ~ $ ip --br addr
lo               UNKNOWN        127.0.0.1/8 10.255.255.254/32 ::1/128 
eth0             UP             172.21.139.255/20 fe80::215:5dff:fe6f:17ae/64 
ovs-system       DOWN           
OVS-1            DOWN           
lxcbr0           DOWN           10.0.3.1/24 
br-51d8f0e2475d  UP             172.19.0.1/16 fe80::60e7:65ff:fe9a:17fe/64 
br-a9824bf3a475  DOWN           172.18.0.1/16 
docker0          DOWN           172.17.0.1/16 fe80::fcdb:b9ff:fe89:dfa1/64 
veth34edb15@if2  UP             fe80::20d2:7bff:fef5:a85e/64 
veth034fd2f@if2  UP             fe80::642f:a2ff:fe4a:4612/64 
vethdbab126@if2  UP             fe80::6c9e:3fff:fe7f:41d/64 
vethc7f4818@if2  UP             fe80::9469:e9ff:fe91:bffa/64 
veth13b4293@if2  UP             fe80::ac76:28ff:fefd:f655/64 
br-b2089135249d  UP             192.168.49.1/24 fe80::2c76:deff:fe65:14bd/64 
vethff44889@if2  UP             fe80::cc29:4fff:fef0:ffa2/64 

 ~ $ miku -- get all
NAME                             READY   STATUS    RESTARTS   AGE
pod/webserver-654d95bc54-5kkrm   1/1     Running   0          2m16s
pod/webserver-654d95bc54-cr9rm   1/1     Running   0          2m50s
pod/webserver-654d95bc54-g8vnt   1/1     Running   0          2m16s
pod/webserver-654d95bc54-hr2gg   1/1     Running   0          2m16s
pod/webserver-654d95bc54-lw6zd   1/1     Running   0          2m16s

NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   32m

NAME                        READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/webserver   5/5     5            5           2m50s

NAME                                   DESIRED   CURRENT   READY   AGE
replicaset.apps/webserver-654d95bc54   5         5         5       2m50s
 ~ $ miku -- logs pod/webserver-654d95bc54-lw6zd
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2026/03/20 13:34:31 [notice] 1#1: using the "epoll" event method
2026/03/20 13:34:31 [notice] 1#1: nginx/1.29.6
2026/03/20 13:34:31 [notice] 1#1: built by gcc 14.2.0 (Debian 14.2.0-19) 
2026/03/20 13:34:31 [notice] 1#1: OS: Linux 6.6.87.2-microsoft-standard-WSL2
2026/03/20 13:34:31 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2026/03/20 13:34:31 [notice] 1#1: start worker processes
2026/03/20 13:34:31 [notice] 1#1: start worker process 29
2026/03/20 13:34:31 [notice] 1#1: start worker process 30
2026/03/20 13:34:31 [notice] 1#1: start worker process 31
2026/03/20 13:34:31 [notice] 1#1: start worker process 32
2026/03/20 13:34:31 [notice] 1#1: start worker process 33
2026/03/20 13:34:31 [notice] 1#1: start worker process 34
2026/03/20 13:34:31 [notice] 1#1: start worker process 35
2026/03/20 13:34:31 [notice] 1#1: start worker process 36

 ~ $ miku -- delete deployment webserver
deployment.apps "webserver" deleted from default namespace
 ~ $ miku -- get po
No resources found in default namespace.
 ~ $ miku -- get all
NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   33m


 ~ $ miku -- create job hello-world --image=hello-world
job.batch/hello-world created
 ~ $ miku -- get jobs
NAME          STATUS     COMPLETIONS   DURATION   AGE
hello-world   Complete   1/1           5s         41s
 ~ $ miku -- create job hello-world-fail --image=hello-world -- /bin/bach -c "exit 1"
job.batch/hello-world-fail created
 ~ $ miku -- get jobs
NAME               STATUS     COMPLETIONS   DURATION   AGE
hello-world        Complete   1/1           5s         3m9s
hello-world-fail   Running    0/1           13s        13s
 ~ $ miku -- get jobs
NAME               STATUS     COMPLETIONS   DURATION   AGE
hello-world        Complete   1/1           5s         3m14s
hello-world-fail   Running    0/1           18s        18s
 ~ $ miku -- get jobs
NAME               STATUS     COMPLETIONS   DURATION   AGE
hello-world        Complete   1/1           5s         3m23s
hello-world-fail   Running    0/1           27s        27s
 ~ $ miku -- get po
NAME                     READY   STATUS               RESTARTS   AGE
hello-world-66gkj        0/1     Completed            0          3m32s
hello-world-fail-bwqgz   0/1     ContainerCannotRun   0          36s
hello-world-fail-dl6jq   0/1     ContainerCreating    0          2s
hello-world-fail-l8g5q   0/1     ContainerCannotRun   0          24s
 ~ $ micu -- get po
micu: command not found
 ~ $ miku -- get po
NAME                     READY   STATUS               RESTARTS   AGE
hello-world-66gkj        0/1     Completed            0          3m54s
hello-world-fail-bwqgz   0/1     ContainerCannotRun   0          58s
hello-world-fail-dl6jq   0/1     ContainerCannotRun   0          24s
hello-world-fail-l8g5q   0/1     ContainerCannotRun   0          46s
 ~ $ miku -- get po
NAME                     READY   STATUS               RESTARTS   AGE
hello-world-66gkj        0/1     Completed            0          4m2s
hello-world-fail-bwqgz   0/1     ContainerCannotRun   0          66s
hello-world-fail-dl6jq   0/1     ContainerCannotRun   0          32s
hello-world-fail-l8g5q   0/1     ContainerCannotRun   0          54s
 ~ $ miku -- logs hello-world-fail-l8g5q
 ~ $ miku -- get all
NAME                         READY   STATUS               RESTARTS   AGE
pod/hello-world-66gkj        0/1     Completed            0          4m56s
pod/hello-world-fail-878kd   0/1     ContainerCannotRun   0          43s
pod/hello-world-fail-bwqgz   0/1     ContainerCannotRun   0          2m
pod/hello-world-fail-dl6jq   0/1     ContainerCannotRun   0          86s
pod/hello-world-fail-l8g5q   0/1     ContainerCannotRun   0          108s

NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   38m

NAME                         STATUS     COMPLETIONS   DURATION   AGE
job.batch/hello-world        Complete   1/1           5s         4m56s
job.batch/hello-world-fail   Running    0/1           2m         2m


 ~ $ miku -- create job job-1 --image=ubuntu -- /bin/bash -c "exit 0"
job.batch/job-1 created
 ~ $ miku -- create job job-2 --image=ubuntu -- /bin/bash -c "exit 1"
job.batch/job-2 created
 ~ $ miku -- get jobs
NAME    STATUS     COMPLETIONS   DURATION   AGE
job-1   Complete   1/1           11s        18s
job-2   Running    0/1           9s         9s
 ~ $ miku -- get po
NAME          READY   STATUS      RESTARTS   AGE
job-1-kmcnj   0/1     Completed   0          28s
job-2-h4wlh   0/1     Error       0          19s
job-2-wqxbn   0/1     Error       0          7s

 ~ $ miku -- delete job job-1
job.batch "job-1" deleted from default namespace
 ~ $ miku -- delete job job-2
job.batch "job-2" deleted from default namespace
Tags: tag