Minikube: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
 
(39 intermediate revisions by the same user not shown)
Line 27: Line 27:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
sudo mkdir -p /etc/apt/keyrings
sudo mkdir -p /etc/apt/keyrings
sudo curl -fsSLo /etc/apt/keyrings/kubernetes-archive-keyring.gpg\
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key\
  https://packages.cloud.google.com/apt/doc/apt-key.gpg
  | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg


cat << EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list >/dev/null
cat << EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list >/dev/null
deb [arch=$(dpkg --print-architecture)\
deb [arch=$(dpkg --print-architecture)\
  signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg]\
  signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg]\
  https://apt.kubernetes.io/ kubernetes-xenial main
  https://pkgs.k8s.io/core:/stable:/v1.30/deb/ /
EOF
EOF


Line 287: Line 287:
{|
{|
|valign='top'|
|valign='top'|
<syntaxhighlight lang="properties">
<syntaxhighlight lang="yaml">
cat <<EOF | kubectl apply -n kubernetes-dashboard -f -
cat << YML | kubectl apply -n kubernetes-dashboard -f -
---
apiVersion: networking.k8s.io/v1
apiVersion: networking.k8s.io/v1
kind: Ingress
kind: Ingress
metadata:
metadata:
   name: kubernetes-dashboard
   name: kubernetes-dashboard
  namespace: kubernetes-dashboard
   labels:
   labels:
     helm.sh/chart: kubernetes-dashboard-1.0.0
     app.kubernetes.io/version: 1.0.0
    app.kubernetes.io/managed-by: kubectl
     app.kubernetes.io/name: kubernetes-dashboard
     app.kubernetes.io/name: kubernetes-dashboard
     app.kubernetes.io/instance: kubernetes-dashboard
     app.kubernetes.io/instance: kubernetes-dashboard
    app.kubernetes.io/version: "1.0.0"
    app.kubernetes.io/managed-by: Helm
spec:
spec:
   ingressClassName: nginx
   ingressClassName: nginx
Line 312: Line 313:
                 port:
                 port:
                   number: 80
                   number: 80
EOF
YML
</syntaxhighlight>
</syntaxhighlight>


|valign='top'|
|valign='top'|
<syntaxhighlight lang="properties">
<syntaxhighlight lang="yaml">
cat <<EOF | kubectl delete -n kubernetes-dashboard -f -
cat <<YML | kubectl delete -n kubernetes-dashboard -f -
---
apiVersion: networking.k8s.io/v1
apiVersion: networking.k8s.io/v1
kind: Ingress
kind: Ingress
metadata:
metadata:
   name: kubernetes-dashboard
   name: kubernetes-dashboard
  namespace: kubernetes-dashboard
   labels:
   labels:
     helm.sh/chart: kubernetes-dashboard-1.0.0
     app.kubernetes.io/version: 1.0.0
    app.kubernetes.io/managed-by: kubectl
     app.kubernetes.io/name: kubernetes-dashboard
     app.kubernetes.io/name: kubernetes-dashboard
     app.kubernetes.io/instance: kubernetes-dashboard
     app.kubernetes.io/instance: kubernetes-dashboard
    app.kubernetes.io/version: "1.0.0"
    app.kubernetes.io/managed-by: Helm
spec:
spec:
   ingressClassName: nginx
   ingressClassName: nginx
Line 341: Line 343:
                 port:
                 port:
                   number: 80
                   number: 80
EOF
YML
</syntaxhighlight>
</syntaxhighlight>


Line 352: Line 354:
|valign='top'|
|valign='top'|


|}
==Mounts » 9P==
'''9P mounts''' are flexible and work across all hypervisors, but '''suffers from performance and reliability issues''' when used with large folders '''(>600 files)'''.
{|
|valign='top'|
<syntaxhighlight lang="bash">
MINIKUBE_BRIDGE="br-$(docker network ls -fname=minikube --format=json|jq -r '.ID')"
sudo ufw allow in on ${MINIKUBE_BRIDGE}
sudo ufw status numbered
sudo ufw reload
</syntaxhighlight>
|valign='top'|
<syntaxhighlight lang="bash">
cat << EXE | sudo -i -u minikube bash
      mkdir -p ${HOME}/volumes
minikube mount ${HOME}/volumes:/var/minikube --port=1980
EXE
</syntaxhighlight>
|}
==Tunnel==
{|
|valign='top'|
<syntaxhighlight lang="bash">
# check minikube user either exists or not
cat /etc/passwd|grep minikube
sudo usermod -aG sudo minikube
</syntaxhighlight>
|valign='top'|
<syntaxhighlight lang="bash">
# minikube no-password sudo access add to EOL
sudo visudo
minikube ALL=(ALL) NOPASSWD: ALL
</syntaxhighlight>
|valign='top'|
<syntaxhighlight lang="bash">
# login to minikube user and start tunneling
sudo -i -u minikube
minikube tunnel
</syntaxhighlight>
|}
|}


Line 373: Line 420:
|-
|-
|valign="top"|
|valign="top"|
cat ~/.minikube/machines/minikube/config.json|jq -r '.Driver.NodeConfig.Memory'
cat ~/.minikube/machines/minikube/config.json|jq -r '.Driver.NodeConfig.CPU'


|valign="top"|
|valign="top"|
minikube config set memory 16384
minikube config get memory
|valign="top"|
minikube config view  memory
minikube config unset memory
|-
|colspan="3"|
----
|-
|valign="top"|
<syntaxhighlight lang="bash">
SYSTEM_RAM_LIMIT=$(awk '/^MemTotal:/ { print int($2/1024); }' /proc/meminfo)
SYSTEM_CPU_LIMIT=$(getconf _NPROCESSORS_ONLN)
minikube config view
minikube config
</syntaxhighlight>


|valign="top" colspan="2"|
<syntaxhighlight lang="bash">
minikube config set memory $((${SYSTEM_RAM_LIMIT}-1024*4))
minikube config set cpus  $((${SYSTEM_CPU_LIMIT}-4))
minikube config set host-only-cidr 10.20.23.1/24
minikube delete && minikube start
</syntaxhighlight>
|-
|colspan="3"|
----
|-
|valign="top"|
|valign="top"|
<syntaxhighlight lang="bash">
minikube start && minikube config view;\
for p in ingress ingress-dns dashboard metrics-server;\
do minikube addons enable ${p};done
</syntaxhighlight>
|valign="top" |
<syntaxhighlight lang="bash">
minikube stop && minikube start
minikube config view
minikube addons list
</syntaxhighlight>
|valign="top" |
kubectl cluster-info dump
kubectl cluster-info
kubectl plugin list
|-
|colspan='3'|
----
|-
|valign='top'|
<syntaxhighlight lang="bash">
kubectl config set-context  minikube --cluster=minikue
kubectl config set-context  minikube
kubectl config get-contexts
kubectl config get-clusters
kubectl config view
</syntaxhighlight>
|valign="top" colspan="2"|
<syntaxhighlight lang="bash">
minikube start -p v1.27 --kubernetes-version v1.27.0
minikube start -p v1.30 --kubernetes-version v1.30.0
minikube profile v1.30
minikube profile list
minikube profile
</syntaxhighlight>
|-
|colspan='3'|
----
|-
|valign='top'|
sudo -i -u minikube minikube status
sudo -i -u minikube minikube ip
minikube stop  -p v1.27
minikube delete -p v1.27
minikube tunnel
|valign='top'|
|valign='top'|


|}
|}
Line 605: Line 738:
* [https://minikube.sigs.k8s.io/docs/handbook/host-access/ Minikube Host Access]
* [https://minikube.sigs.k8s.io/docs/handbook/host-access/ Minikube Host Access]
* [https://minikube.sigs.k8s.io/docs/handbook/dashboard/ Minikube Dashboard]
* [https://minikube.sigs.k8s.io/docs/handbook/dashboard/ Minikube Dashboard]
* [https://minikube.sigs.k8s.io/docs/handbook/registry/ Minikube Registry]
* [[Minikube Registry]]
* [https://minikube.sigs.k8s.io/docs/handbook/addons/ Minikube Addons]
* [https://minikube.sigs.k8s.io/docs/handbook/addons/ Minikube Addons]


Line 650: Line 783:
|-
|-
| valign="top" |
| valign="top" |
* [https://magda.io/docs/how-to-setup-https-to-local-cluster.html Minikube » Create Self-Signed Cert Issuer]
* [https://stackoverflow.com/questions/63559779/ Minikube » Local FS As Persistent Volume]
* [https://stackoverflow.com/questions/63559779/ Minikube » Local FS As Persistent Volume]
* [https://minikube.sigs.k8s.io/docs/handbook/untrusted_certs/ Minikube » Untrusted Root Certificates]
* [https://github.com/kubernetes/minikube/issues/15616 Minikube » Clusters » Communication]
* [https://minikube.sigs.k8s.io/docs/tutorials/local_path_provisioner/ Minikube » Local Path Provisioner]
* [https://minikube.sigs.k8s.io/docs/tutorials/local_path_provisioner/ Minikube » Local Path Provisioner]
* [https://medium.com/@abdulfayis/storage-orchestration-for-kubernetes-c6370f943e23 K8s » Storage » Orchestration]
* [https://medium.com/@abdulfayis/storage-orchestration-for-kubernetes-c6370f943e23 K8s » Storage » Orchestration]
* [https://kubernetes.io/docs/concepts/storage/volumes/#hostpath K8s » Volume » HostPath]
* [https://kubernetes.io/docs/concepts/storage/volumes/#hostpath K8s » Volume » HostPath]
* [https://kubernetes.io/docs/concepts/storage/volumes/#local K8s » Volume » Local]
* [https://kubernetes.io/docs/concepts/storage/volumes/#local K8s » Volume » Local]
* [https://jeyaramashok.github.io/posts/minikube-profiles/ Minikube » Profiles]
* [https://minikube.sigs.k8s.io/docs/commands/profile/ Minikube » Profile]


| valign="top" |
| valign="top" |
* [https://stackoverflow.com/questions/48534980/ Minikube » Mount Host directory into Pod]
* [https://itnext.io/setting-up-self-signed-https-access-to-local-dev-k8s-cluster-in-minikube-539bc62ad62f Minikube » Setting Up Self-Signed HTTPS]
* [https://stackoverflow.com/questions/55357287/ K8s » Patch » Node Selector On The Fly]
* [[K8s/CSI Hostpath Driver|K8s » CSI Hostpath Driver]]
* [[K8s/Swiss Knife|K8s » Swiss Knife]]
* [[K8s/Ingress|K8s » Ingress]]
* [[K8s/Service|K8s » Service]]
* [[K8s/Run|K8s » Run]]


| valign="top" |
| valign="top" |
Line 666: Line 812:
| valign="top" |
| valign="top" |
* [https://stackoverflow.com/questions/6481005/ Bash » Get the number of CPUs in Linux]
* [https://stackoverflow.com/questions/6481005/ Bash » Get the number of CPUs in Linux]
* [https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/ <code>kubectl</code> » Extend with plugins]
* [https://unix.stackexchange.com/questions/415519/ Bash » Available memory]
* [https://unix.stackexchange.com/questions/415519/ Bash » Available memory]
* [[Minikube Ingress DNS]]
* [[Minikube Ingress DNS| Minikube » Ingress DNS]]
* [[Minikube Systemd|Minikube » Systemd]]
* [[Minikube MetalLB|Minikube » MetalLB]]
* [[Minikube Registry|Minikube » Registry]]
* [[Minikube Tunnel|Minikube » Tunnel]]
* [[Free Up RAM]]
* [[CIDR]]
* [[UFW]]


| valign="top" |
| valign="top" |
* [[Linux User Creation]]
* [[Swap Space]]


| valign="top" |
| valign="top" |


|}
|}

Latest revision as of 23:00, 18 December 2024

sudo mkdir -p /opt/cli/minikube-linux-amd64/bin
sudo wget -cq https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64\
 -O /opt/cli/minikube-linux-amd64/bin/minikube

sudo chmod +x /opt/cli/minikube-linux-amd64/bin/minikube
sudo update-alternatives --install /usr/local/bin/minikube minikube\
 /opt/cli/minikube-linux-amd64/bin/minikube 1980
Order Port Type Internal IP Internal Port External IP External Port
1 TCP 0.0.0.0 32443 127.0.0.1 49153
2 TCP 0.0.0.0 8443 127.0.0.1 49154
3 TCP 0.0.0.0 5000 127.0.0.1 49155
4 TCP 0.0.0.0 2376 127.0.0.1 49156
5 TCP 0.0.0.0 22 127.0.0.1 49157

Kubectl

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key\
 | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg

cat << EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list >/dev/null
deb [arch=$(dpkg --print-architecture)\
 signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg]\
 https://pkgs.k8s.io/core:/stable:/v1.30/deb/ /
EOF

sudo apt update
sudo apt install kubectl

Cluster

minikube start
:'
😄  minikube v1.29.0 on Ubuntu 22.04
✨  Automatically selected the docker driver. Other choices: kvm2, qemu2, none, ssh
📌  Using Docker driver with root privileges
👍  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
💾  Downloading Kubernetes v1.26.1 preload ...
    > preloaded-images-k8s-v18-v1...:  397.05 MiB / 397.05 MiB  100.00% 33.42 M
    > gcr.io/k8s-minikube/kicbase...:  407.19 MiB / 407.19 MiB  100.00% 7.46 Mi
🔥  Creating docker container (CPUs=2, Memory=5900MB) ...
🐳  Preparing Kubernetes v1.26.1 on Docker 20.10.23 ...
    ▪ Generating certificates and keys ...
    ▪ Booting up control plane ...
    ▪ Configuring RBAC rules ...
🔗  Configuring bridge CNI (Container Networking Interface) ...
    ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🌟  Enabled addons: storage-provisioner, default-storageclass
🔎  Verifying Kubernetes components...
🏄  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
'
kubectl get po -A
minikube kubectl -- get po -A
:'
NAMESPACE     NAME                               READY   STATUS    RESTARTS        AGE
kube-system   coredns-64897985d-thxhw            1/1     Running   0               8m14s
kube-system   etcd-minikube                      1/1     Running   0               8m26s
kube-system   kube-apiserver-minikube            1/1     Running   0               8m26s
kube-system   kube-controller-manager-minikube   1/1     Running   0               8m26s
kube-system   kube-proxy-xqfl2                   1/1     Running   0               8m13s
kube-system   kube-scheduler-minikube            1/1     Running   0               8m26s
kube-system   storage-provisioner                1/1     Running   1 (7m43s ago)   8m25s
'

Dashboard

minikube addons enable metrics-server
minikube dashboard
:'
🔌  Enabling  ...
    ▪ Using image kubernetesui/metrics-scraper:v1.0.7
    ▪ Using image kubernetesui/dashboard:v2.3.1
🤔  Verifying dashboard health ...
🚀  Launching proxy ...
🤔  Verifying proxy health ...
🎉  Opening http://127.0.0.1:36403/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ in your default browser...
Gtk-Message: 17:34:36.652: Failed to load module "canberra-gtk-module"
Gtk-Message: 17:34:36.654: Failed to load module "canberra-gtk-module"
'

Deploy

Deployment/NodePort:
kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.4
kubectl expose deployment hello-minikube --type=NodePort --port=8080

kubectl port-forward service/hello-minikube 7080:8080
http://localhost:7080/

kubectl get services      hello-minikube
kubectl delete services   hello-minikube
kubectl delete deployment hello-minikube
Deployment/LoadBalancer:
kubectl create deployment balanced --image=k8s.gcr.io/echoserver:1.4  
kubectl expose deployment balanced --type=LoadBalancer --port=8080

kubectl get services      balanced
kubectl delete services   balanced
kubectl delete deployment balanced

Example

docker build -t chorke/crawler:1.0.00 -f ./Dockerfile .
docker tag      chorke/crawler:1.0.00 reg.chorke.org/chorke/crawler:1.0.00
docker push     reg.chorke.org/chorke/crawler:1.0.00
docker pull     hub.chorke.org/chorke/crawler:1.0.00
docker tag      hub.chorke.org/chorke/crawler:1.0.00 chorke/crawler:1.0.00

minikube image load chorke/crawler:1.0.00
minikube image ls --format table
kubectl run crawler --image=chorke/crawler:1.0.00 --image-pull-policy=Never --restart=Never
kubectl logs crawler
kubectl get pod

kubectl delete pod crawler -n default
kubectl delete pod crawler
Deployment/NodePort:
kubectl create deployment crawler --image=chorke/crawler:1.0.00
kubectl expose deployment crawler --type=NodePort --port=1983

kubectl port-forward service/crawler 1983:1983
http://localhost:1983/crawler

kubectl get services      crawler
kubectl delete services   crawler
kubectl delete deployment crawler

Ingress DNS

minikube start
cat /etc/resolv.conf | grep nameserver
minikube addons enable ingress
minikube addons enable ingress-dns
nslookup academia.local
nslookup academia.local $(minikube ip)

kubectl get configmap coredns -n kube-system -o yaml
kubectl get configmap coredns -n kube-system -o "jsonpath={.data.Corefile}"

Volatile Fixes

RESOLVE='/etc/resolv.conf';\
printf -v K8S_DNS '%s' $(minikube ip);\
if  [ -f ${RESOLVE} ]&&[ "$(grep -c ${K8S_DNS} ${RESOLVE})" == 0 ];then\
 cat << EOF | sudo tee -a ${RESOLVE} >/dev/null

nameserver ${K8S_DNS}
EOF
fi;\
cat ${RESOLVE}

Robust Fixes

RESOLVE='/etc/systemd/resolved.conf';\
printf -v K8S_DNS '%s' $(minikube ip);\
if  [ -f ${RESOLVE} ]&&[ "$(grep -c ${K8S_DNS} ${RESOLVE})" == 0 ];then\
 cat << EOF | sudo tee -a ${RESOLVE} >/dev/null

# k8s coredns
DNS=${K8S_DNS}
EOF
fi;\
cat ${RESOLVE}
sudo systemctl restart systemd-resolved
sudo systemctl status  systemd-resolved

sudo systemctl restart NetworkManager.service
systemctl status NetworkManager.service
systemctl status systemd-resolved
systemctl status dnsmasq
cat /etc/resolv.conf | grep nameserver
nmcli dev show | grep DNS
journalctl -u dnsmasq
tail /var/log/syslog

kubectl edit configmap coredns -n kube-system
apiVersion: v1
data:
  Corefile: |
    .:53 {
        errors

        reload
        loadbalance
    }
    k8s.local:53 {
        errors
        cache 30
        forward . 192.168.49.2
    }
    academia.local:53 {
        errors
        cache 30
        forward . 192.168.49.2
    }
kind: ConfigMap
metadata:
  creationTimestamp: "2023-07-04T00:08:54Z"
  name: coredns
  namespace: kube-system
  resourceVersion: "300"
  uid: d8eec45d-1452-467f-8861-8811658c773a

kubectl run -i --tty --rm debug --image=busybox --restart=Never -- nslookup academia.local
kubectl run -i --tty --rm debug --image=busybox --restart=Never -- ping academia.local

kubectl run -i --tty --rm debug --image=alpine  --restart=Never -- nslookup academia.local
kubectl run -i --tty --rm debug --image=alpine  --restart=Never -- ping academia.local

Ingress DNS » Dashboard


cat << YML | kubectl apply -n kubernetes-dashboard -f -
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: kubernetes-dashboard
  namespace: kubernetes-dashboard
  labels:
    app.kubernetes.io/version: 1.0.0
    app.kubernetes.io/managed-by: kubectl
    app.kubernetes.io/name: kubernetes-dashboard
    app.kubernetes.io/instance: kubernetes-dashboard
spec:
  ingressClassName: nginx
  rules:
    - host: "www.k8s.local"
      http:
        paths:
          - path: /
            pathType: ImplementationSpecific
            backend:
              service:
                name: kubernetes-dashboard
                port:
                  number: 80
YML
cat <<YML | kubectl delete -n kubernetes-dashboard -f -
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: kubernetes-dashboard
  namespace: kubernetes-dashboard
  labels:
    app.kubernetes.io/version: 1.0.0
    app.kubernetes.io/managed-by: kubectl
    app.kubernetes.io/name: kubernetes-dashboard
    app.kubernetes.io/instance: kubernetes-dashboard
spec:
  ingressClassName: nginx
  rules:
    - host: "www.k8s.local"
      http:
        paths:
          - path: /
            pathType: ImplementationSpecific
            backend:
              service:
                name: kubernetes-dashboard
                port:
                  number: 80
YML

Mounts » 9P

9P mounts are flexible and work across all hypervisors, but suffers from performance and reliability issues when used with large folders (>600 files).

MINIKUBE_BRIDGE="br-$(docker network ls -fname=minikube --format=json|jq -r '.ID')"
sudo ufw allow in on ${MINIKUBE_BRIDGE}
sudo ufw status numbered
sudo ufw reload
cat << EXE | sudo -i -u minikube bash
      mkdir -p ${HOME}/volumes
minikube mount ${HOME}/volumes:/var/minikube --port=1980
EXE

Tunnel

# check minikube user either exists or not
cat /etc/passwd|grep minikube
sudo usermod -aG sudo minikube
# minikube no-password sudo access add to EOL
sudo visudo
minikube ALL=(ALL) NOPASSWD: ALL
# login to minikube user and start tunneling
sudo -i -u minikube
minikube tunnel

Playground

minikube image rm docker.io/jenkins/jenkins:2.452.1-jdk17
minikube image ls
minikube config view host-only-cidr
minikube config get  host-only-cidr
minikube config list
minikube status

cat ~/.minikube/machines/minikube/config.json|jq -r '.Driver.NodeConfig.Memory'
cat ~/.minikube/machines/minikube/config.json|jq -r '.Driver.NodeConfig.CPU'
minikube config set memory 16384
minikube config get memory
minikube config view  memory
minikube config unset memory

SYSTEM_RAM_LIMIT=$(awk '/^MemTotal:/ { print int($2/1024); }' /proc/meminfo)
SYSTEM_CPU_LIMIT=$(getconf _NPROCESSORS_ONLN)
minikube config view
minikube config
minikube config set memory $((${SYSTEM_RAM_LIMIT}-1024*4))
minikube config set cpus   $((${SYSTEM_CPU_LIMIT}-4))
minikube config set host-only-cidr 10.20.23.1/24
minikube delete && minikube start

minikube start && minikube config view;\
for p in ingress ingress-dns dashboard metrics-server;\
do minikube addons enable ${p};done
minikube stop && minikube start
minikube config view
minikube addons list
kubectl cluster-info dump
kubectl cluster-info
kubectl plugin list

kubectl config set-context  minikube --cluster=minikue
kubectl config set-context  minikube
kubectl config get-contexts
kubectl config get-clusters
kubectl config view
minikube start -p v1.27 --kubernetes-version v1.27.0
minikube start -p v1.30 --kubernetes-version v1.30.0
minikube profile v1.30
minikube profile list
minikube profile

sudo -i -u minikube minikube status
sudo -i -u minikube minikube ip
minikube stop   -p v1.27
minikube delete -p v1.27
minikube tunnel

Knowledge

minikube stop
minikube start
minikube pause

minikube delete
minikube unpause
minikube addons list
minikube delete --all
minikube docker-env
minikube image ls --format table
minikube config set memory 16384
 
minikube start --cpus 8 --memory 16384
eval $(minikube -p minikube docker-env)
minikube start -p aged --kubernetes-version=v1.16.1
minikube start -p aged --kubernetes-version=v1.24.0

docker ps -a
docker images
docker image ls
docker network ls

docker rm $(docker ps -a -q)
docker stop $(docker ps -a -q)

docker build\
 -t chorke/crawler:1.0.00 -f ./Dockerfile .

docker logs crawler
docker stop crawler && docker rm crawler
kubectl get pod
kubectl cluster-info
kubectl get namespaces
kubectl -n kube-system get svc -o wide

minikube image ls --format table
minikube image load chorke/crawler:1.0.00

kubectl run crawler --image=chorke/crawler:1.0.00\
 --image-pull-policy=Never --restart=Never

kubectl logs crawler
kubectl delete pod crawler

docker container inspect minikube \
--format="{{ (index (index .NetworkSettings.Ports \"8443/tcp\") 0).HostPort }}"

docker container ls --filter=name=minikube --format="{{.Ports}}" | tr , \\n

kubectl get po -A
kubectl explain pods
kubectl get services
kubectl get services crawler
kubectl describe pods crawler
kubectl get pods --all-namespaces

kubectl get services
kubectl get services -n default
kubectl get services --all-namespaces

kubectl delete pod crawler
kubectl delete -n default pod crawler

kubectl delete services crawler
kubectl delete deployment crawler

kubectl get nodes
kubectl get pods -o wide
kubectl get po,jobs,cronjob
minikube kubectl -- get po -A
minikube kubectl -- explain pods
minikube kubectl -- get services
minikube kubectl -- get service crawler
minikube kubectl -- describe pods crawler
minikube kubectl -- get pods --all-namespaces 

minikube service --all
minikube service list -n default
minikube service list

minikube kubectl -- delete pod crawler
minikube kubectl -- delete -n default pod crawler

minikube kubectl -- delete services crawler
minikube kubectl -- delete deployment crawler

minikube kubectl -- get nodes
minikube kubectl -- get pods -o wide
minikube kubectl -- get po,jobs,cronjob

minikube addons enable metallb
minikube addons enable olm
minikube addons list
minikube addons enable default-storageclass
minikube addons enable metrics-server
minikube addons configure metallb

minikube addons enable storage-provisioner
minikube addons enable dashboard

minikube ssh
minikube addons enable ingress-dns
minikube addons enable ingress

ping host.minikube.internal

kubectl get configmap coredns -n kube-system -o yaml
nslookup academia.local $(minikube ip)

getconf _NPROCESSORS_CONF
getconf _NPROCESSORS_ONLN
nproc --all
grep ^cpu\\scores /proc/cpuinfo | uniq |  awk '{print $4}'
python -c 'import os; print(os.cpu_count())'
grep -c ^processor /proc/cpuinfo

awk '/^MemAvailable:/ { print $2/1024; }' /proc/meminfo
awk '/^MemTotal:/ { print $2/1024; }' /proc/meminfo
awk '/^MemFree:/ { print $2/1024; }' /proc/meminfo

References