k3d 使用介绍

发布时间: 更新时间: 总字数:288 阅读时间:1m 作者: IP上海 分享 网址

k3d 是在 docker 中运行 k3s(Rancher Lab 的最小 Kubernetes 发行版)的轻量级包装器。

介绍

k3d 使在 docker 中创建单节点和多节点 k3s 集群变得非常容易,例如,可用于 Kubernetes 上的本地开发。

安装

Bash

wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash

Mac

brew install k3d

使用

help

k3d help ...
$ k3d help
https://k3d.io/
k3d is a wrapper CLI that helps you to easily create k3s clusters inside docker.
Nodes of a k3d cluster are docker containers running a k3s image.
All Nodes of a k3d cluster are part of the same docker network.

Usage:
  k3d [flags]
  k3d [command]

Available Commands:
  cluster      Manage cluster(s)
  completion   Generate completion scripts for [bash, zsh, fish, powershell | psh]
  config       Work with config file(s)
  help         Help about any command
  image        Handle container images.
  kubeconfig   Manage kubeconfig(s)
  node         Manage node(s)
  registry     Manage registry/registries
  version      Show k3d and default k3s version

Flags:
  -h, --help         help for k3d
      --timestamps   Enable Log timestamps
      --trace        Enable super verbose output (trace logging)
      --verbose      Enable verbose output (debug logging)
      --version      Show k3d and default k3s version

Use "k3d [command] --help" for more information about a command.

demo

# 创建 k3d 集群
k3d cluster create dev
k3d cluster create --servers 1 --agents 2 --k3s-arg "--disable=traefik@server:0" dev --wait --verbose

# 停止集群
k3d cluster stop dev

# 启动集群
k3d cluster start dev

创建成功后,既可以使用 kubectl get nodes 命令了

参考

  1. https://k3d.io/
  2. https://github.com/k3d-io/k3d
Home Archives Categories Tags Statistics
本文总阅读量 次 本站总访问量 次 本站总访客数