K8S minikube本地安装

一. mac安装K8S

1.brew安装

brew install kubectl

2.查看版本

kubectl version --output=json

{
  "clientVersion": {
    "major": "1",
    "minor": "27",
    "gitVersion": "v1.27.2",
    "gitCommit": "7f6f68fdabc4df88cfea2dcf9a19b2b830f1e647",
    "gitTreeState": "clean",
    "buildDate": "2023-05-17T14:13:27Z",
    "goVersion": "go1.20.4",
    "compiler": "gc",
    "platform": "darwin/amd64"
  },
  "kustomizeVersion": "v5.0.1"
}

The connection to the server 127.0.0.1:6443 was refused - did you specify the right host or port?

还没有在本地运行k8s集群

二. 安装minikube

2.1 brew install安装minikube

brew install minikube

K8S minikube本地安装_第1张图片

2.2 minikube开启k8s

minikube start

K8S minikube本地安装_第2张图片

 

2.3 kubectl命令查看相关信息

kubectl cluster-info

查看pods 

kubectl get po -A
NAMESPACE     NAME                               READY   STATUS    RESTARTS      AGE
kube-system   coredns-787d4945fb-97qlx           1/1     Running   0             13m
kube-system   etcd-minikube                      1/1     Running   0             13m
kube-system   kube-apiserver-minikube            1/1     Running   0             13m
kube-system   kube-controller-manager-minikube   1/1     Running   0             13m
kube-system   kube-proxy-kvcj7                   1/1     Running   0             13m
kube-system   kube-scheduler-minikube            1/1     Running   0             13m
kube-system   storage-provisioner                1/1     Running   1 (13m ago)   13m

查看node信息

kubectl get nodes
NAME       STATUS   ROLES           AGE   VERSION
minikube   Ready    control-plane   16m   v1.26.3

2.4 开启dashboard

minikube dashboard

http://127.0.0.1:62643/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/#/workloads?namespace=default

K8S minikube本地安装_第3张图片

 K8S minikube本地安装_第4张图片

 

三. minikube常用命令

Pause Kubernetes without impacting deployed applications:

minikube pause

Unpause a paused instance:

minikube unpause

Halt the cluster:

minikube stop

Change the default memory limit (requires a restart):

minikube config set memory 9001

Browse the catalog of easily installed Kubernetes services:

minikube addons list

Create a second cluster running an older Kubernetes release:

minikube start -p aged --kubernetes-version=v1.16.1

Delete all of the minikube clusters:

minikube delete --all

你可能感兴趣的:(linux,运维,服务器)