https://minikube.sigs.k8s.io/docs/start/
https://kubernetes.io/zh-cn/docs/tasks/tools/install-kubectl-linux/
yum install bash-completion -y
curl https://download.docker.com/linux/centos/docker-ce.repo -o /etc/yum.repos.d/docker-ce.repo
yum install docker-ce -y
【curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
】
swapoff -a
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-latest.x86_64.rpm
sudo rpm -Uvh minikube-latest.x86_64.rpm
出现报错
[root@localhost ~]# minikube start
* minikube v1.31.2 on Rocky 9.2
* Unable to pick a default driver. Here is what was considered, in preference order:
* Alternatively you could install one of these drivers:
- docker: Not installed: exec: "docker": executable file not found in $PATH
- kvm2: Not installed: exec: "virsh": executable file not found in $PATH
- podman: Not installed: exec: "podman": executable file not found in $PATH
- qemu2: Not installed: exec: "qemu-system-x86_64": executable file not found in $PATH
- virtualbox: Not installed: unable to find VBoxManage in $PATH
X Exiting due to DRV_NOT_DETECTED: No possible driver was detected. Try specifying --driver, or see https://minikube.sigs.k8s.io/docs/start/
[root@localhost ~]# minikube start
* minikube v1.31.2 on Rocky 9.2
* Unable to pick a default driver. Here is what was considered, in preference order:
* Alternatively you could install one of these drivers:
- docker: Not installed: exec: "docker": executable file not found in $PATH
- kvm2: Not installed: exec: "virsh": executable file not found in $PATH
- podman: Not installed: exec: "podman": executable file not found in $PATH
- qemu2: Not installed: exec: "qemu-system-x86_64": executable file not found in $PATH
- virtualbox: Not installed: unable to find VBoxManage in $PATH
X Exiting due to DRV_NOT_DETECTED: No possible driver was detected. Try specifying --driver, or see https://minikube.sigs.k8s.io/docs/start/
[root@localhost ~]# yum -y install docker
遇到问题不能用root
[root@localhost ~]# minikube start
* minikube v1.31.2 on Rocky 9.2
* Automatically selected the podman driver. Other choices: ssh, none
* The "podman" driver should not be used with root privileges. If you wish to continue as root, use --force.
* If you are running minikube within a VM, consider using --driver=none:
* https://minikube.sigs.k8s.io/docs/reference/drivers/none/
X Exiting due to DRV_AS_ROOT: The "podman" driver should not be used with root privileges.
[root@localhost ~]# minikube start --force
* minikube v1.31.2 on Rocky 9.2
! minikube skips various validations when --force is supplied; this may lead to unexpecte
* Using the docker driver based on existing profile
* The "docker" driver should not be used with root privileges. If you wish to continue as
* If you are running minikube within a VM, consider using --driver=none:
* https://minikube.sigs.k8s.io/docs/reference/drivers/none/
* Tip: To remove this root owned cluster, run: sudo minikube delete
* Starting control plane node minikube in cluster minikube
* Pulling base image ...
> index.docker.io/kicbase/sta...: 447.57 MiB / 447.62 MiB 99.99% 804.38 K
! minikube was unable to download gcr.io/k8s-minikube/kicbase:v0.0.40, but successfully downloaded docker.io/kicbase/stable:v0.0.40 as a fallback image
* Creating docker container (CPUs=2, Memory=2200MB) ...
* Preparing Kubernetes v1.27.4 on Docker 24.0.4 ...
- 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
* Verifying Kubernetes components...
* 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 dashboard --url遇到错误添加“insecure-registries":[“ip:port”]
[root@localhost ~]# minikube status
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
[root@localhost ~]# minikube status
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
[root@localhost ~]# minikube dashboard --url
* Enabling dashboard ...
- Using image docker.io/kubernetesui/dashboard:v2.7.0
- Using image docker.io/kubernetesui/metrics-scraper:v1.0.8
* Some dashboard features require the metrics-server addon. To enable all features please run:
minikube addons enable metrics-server
* Verifying dashboard health ...
* Launching proxy ...
X Exiting due to HOST_KUBECTL_PROXY: kubectl proxy: download failed: https://dl.k8s.io/release/v1.27.4/bin/linux/amd64/kubectl?checksum=file:https://dl.k8s.io/release/v1.27.4/bin/linux/amd64/kubectl.sha256: getter: &{Ctx:context.Background Src:https://dl.k8s.io/release/v1.27.4/bin/linux/amd64/kubectl?checksum=file:https://dl.k8s.io/release/v1.27.4/bin/linux/amd64/kubectl.sha256 Dst:/root/.minikube/cache/linux/amd64/v1.27.4/kubectl.download Pwd: Mode:2 Umask:---------- Detectors:[0x3f9c8a8 0x3f9c8a8 0x3f9c8a8 0x3f9c8a8 0x3f9c8a8 0x3f9c8a8 0x3f9c8a8] Decompressors:map[bz2:0xc00012a438 gz:0xc00012a500 tar:0xc00012a480 tar.bz2:0xc00012a4c0 tar.gz:0xc00012a4d0 tar.xz:0xc00012a4e0 tar.zst:0xc00012a4f0 tbz2:0xc00012a4c0 tgz:0xc00012a4d0 txz:0xc00012a4e0 tzst:0xc00012a4f0 xz:0xc00012a508 zip:0xc00012a510 zst:0xc00012a520] Getters:map[file:0xc000f8d310 http:0xc000cde460 https:0xc000cde4b0] Dir:false ProgressListener:0x3f579a0 Insecure:false DisableSymlinks:false Options:[0x12d0880]}: invalid checksum: Error downloading checksum file: Get "https://cdn.dl.k8s.io/release/v1.27.4/bin/linux/amd64/kubectl.sha256": dial tcp 151.101.109.55:443: connect: connection refused
*
╭─────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ * If the above advice does not help, please let us know: │
│ https://github.com/kubernetes/minikube/issues/new/choose │
│ │
│ * Please run `minikube logs --file=logs.txt` and attach logs.txt to the GitHub issue. │
│ * Please also attach the following file to the GitHub issue: │
│ * - /tmp/minikube_dashboard_5c6ee63914fe10bf382570a88e47ceb0f9efddd6_0.log │
│ │
╰─────────────────────────────────────────────────────────────────────────────────────────────╯
[root@localhost ~]# ping 151.101.109.55
PING 151.101.109.55 (151.101.109.55) 56(84) bytes of data.
64 bytes from 151.101.109.55: icmp_seq=1 ttl=128 time=74.2 ms
64 bytes from 151.101.109.55: icmp_seq=2 ttl=128 time=74.5 ms
64 bytes from 151.101.109.55: icmp_seq=3 ttl=128 time=73.6 ms
64 bytes from 151.101.109.55: icmp_seq=4 ttl=128 time=74.4 ms
^C
--- 151.101.109.55 ping statistics ---
5 packets transmitted, 4 received, 20% packet loss, time 4007ms
rtt min/avg/max/mdev = 73.621/74.172/74.491/0.338 ms
[root@localhost ~]#
[root@localhost ~]# vi /etc/docker/daemon.json
{
"registry-mirrors": ["https://xxxxxx.mirror.aliyuncs.com"],
"insecure-registries":["ip:port"]
}
[root@localhost ~]# alias kubectl="minikube kubectl --"
[root@localhost ~]# minikube dashboard --url
* Verifying dashboard health ...
* Launching proxy ...
* Verifying proxy health ...
http://127.0.0.1:36765/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/
[root@localhost ~]# find / -name kubectl
/root/.minikube/cache/linux/amd64/v1.27.4/kubectl
/var/lib/docker/volumes/minikube/_data/lib/minikube/binaries/v1.27.4/kubectl
[root@localhost ~]# /root/.minikube/cache/linux/amd64/v1.27.4/kubectl proxy --port=30030 --address='0.0.0.0' --accept-hosts='^.*' &
[1] 79905
[root@localhost ~]# Starting to serve on [::]:30030
[root@localhost ~]# /root/.minikube/cache/linux/amd64/v1.27.4/kubectl proxy --port=30030 --address='0.0.0.0' --accept-hosts='^.*' &
[root@localhost ~]# netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:36765 0.0.0.0:* LISTEN 78508/kubectl
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 856/sshd: /usr/sbin
tcp 0 0 127.0.0.1:32815 0.0.0.0:* LISTEN 74636/docker-proxy
tcp 0 0 127.0.0.1:32814 0.0.0.0:* LISTEN 74621/docker-proxy
tcp 0 0 127.0.0.1:32813 0.0.0.0:* LISTEN 74606/docker-proxy
tcp 0 0 127.0.0.1:32817 0.0.0.0:* LISTEN 74661/docker-proxy
tcp 0 0 127.0.0.1:32816 0.0.0.0:* LISTEN 74648/docker-proxy
tcp6 0 0 :::22 :::* LISTEN 856/sshd: /usr/sbin
tcp6 0 0 :::30030 :::* LISTEN 79905/kubectl
[root@localhost ~]# minikube kubectl -- get pods -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-5d78c9869d-bpr2k 1/1 Running 1 (10m ago) 43m
kube-system etcd-minikube 1/1 Running 1 (10m ago) 43m
kube-system kube-apiserver-minikube 1/1 Running 1 (10m ago) 43m
kube-system kube-controller-manager-minikube 1/1 Running 1 (10m ago) 43m
kube-system kube-proxy-567m4 1/1 Running 1 (10m ago) 43m
kube-system kube-scheduler-minikube 1/1 Running 1 (10m ago) 43m
kube-system storage-provisioner 1/1 Running 3 (8m27s ago) 43m
kubernetes-dashboard dashboard-metrics-scraper-5dd9cbfd69-gn7vg 1/1 Running 1 (10m ago) 41m
kubernetes-dashboard kubernetes-dashboard-5c5cfc8747-qgtl9 1/1 Running 2 (8m27s ago) 41m