minikube 使用指南

什么是 minikube ?

它是本地的 kubernetes ,專注于學(xué)習(xí)和開(kāi)發(fā)的 kubernetes 本地虛擬環(huán)境。

名稱 地址
官方網(wǎng)址 https://minikube.sigs.k8s.io/
其它平臺(tái)和架構(gòu)下安裝程序 https://minikube.sigs.k8s.io/docs/start/

安裝 minikube

注意:在使用 minikube 需要提前安裝好 dockerkubernetes

在 linux 下安裝 minikube

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube

在 macos 下安裝 minikube

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-amd64
sudo install minikube-darwin-amd64 /usr/local/bin/minikube

在 windows 下安裝 minikube

  1. 在管理員模式下打開(kāi) PowerShell 執(zhí)行下面的命令
New-Item -Path 'c:\' -Name 'minikube' -ItemType Directory -Force
Invoke-WebRequest -OutFile 'c:\minikube\minikube.exe' -Uri 'https://github.com/kubernetes/minikube/releases/latest/download/minikube-windows-amd64.exe' -UseBasicParsing
  1. 在管理員模式下打開(kāi) PowerShell 添加環(huán)境變量
$oldPath = [Environment]::GetEnvironmentVariable('Path', [EnvironmentVariableTarget]::Machine)
if ($oldPath.Split(';') -inotcontains 'C:\minikube'){ `
  [Environment]::SetEnvironmentVariable('Path', $('{0};C:\minikube' -f $oldPath), [EnvironmentVariableTarget]::Machine) `
}

驗(yàn)證是否安裝成功

$ minikube version
minikube version: v1.25.2
commit: 362d5fdc0a3dbee389b3d3f1034e8023e72bd3a7

基本操作

  • 啟動(dòng)集群
minikube start
  • 國(guó)內(nèi)鏡像啟動(dòng)集群
minikube start --image-mirror-country=cn
  • 停止集群
minikube stop
  • 清空集群
minikube delete --all
  • 在瀏覽器中打開(kāi)儀表板 Kubernetes Dashboard
minikube dashboard

獲取幫助

$ minikube --help                                                                      
minikube provisions and manages local Kubernetes clusters optimized for development workflows.

Basic Commands:
  start          Starts a local Kubernetes cluster
  status         Gets the status of a local Kubernetes cluster
  stop           Stops a running local Kubernetes cluster
  delete         Deletes a local Kubernetes cluster
  dashboard      訪問(wèn)在 minikube 集群中運(yùn)行的 kubernetes dashboard
  pause          pause Kubernetes
  unpause        恢復(fù) Kubernetes

Images Commands:
  docker-env     配置環(huán)境以使用 minikube's Docker daemon
  podman-env     配置環(huán)境以使用 minikube's Podman service
  cache          Add, delete, or push a local image into minikube
  image          Manage images

Configuration and Management Commands:
  addons         Enable or disable a minikube addon
  config         Modify persistent configuration values
  profile        Get or list the current profiles (clusters)
  update-context Update kubeconfig in case of an IP or port change

Networking and Connectivity Commands:
  service        Returns a URL to connect to a service
  tunnel         連接到 LoadBalancer 服務(wù)

Advanced Commands:
  mount          將指定的目錄掛載到 minikube
  ssh            Log into the minikube environment (for debugging)
  kubectl        Run a kubectl binary matching the cluster version
  node           Add, remove, or list additional nodes
  cp             Copy the specified file into minikube

Troubleshooting Commands:
  ssh-key        Retrieve the ssh identity key path of the specified node
  ssh-host       Retrieve the ssh host key of the specified node
  ip             Retrieves the IP address of the specified node
  logs           Returns logs to debug a local Kubernetes cluster
  update-check   打印當(dāng)前和最新版本版本
  version        打印 minikube 版本
  options        顯示全局命令行選項(xiàng)列表 (應(yīng)用于所有命令)。

Other Commands:
  completion     Generate command completion for a shell

Use "minikube <command> --help" for more information about a given command.
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容