Talos-docker版本中创建 Kubernetes 集群
在talos容器化版本中部署Kubernetes集群,用于折腾学习。
1.系统信息
虚拟机软件:VMware Worktation
虚拟机配置:4G内存 4vCPU 200GB磁盘
操作系统:CentOS7.9
docker:20.10.15
PS:为啥VMware Worktation,问就是因为穷,没有服务器;为啥CentOS7.9,之前部署的CentOS虚拟机+docker环境,直接使用了。Talos官网上对docker的版本有要求:
安装talosctl
curl -Lo /usr/local/bin/talosctl https://github.com/siderolabs/talos/releases/download/v1.0.4/talosctl-$(uname -s | tr "[:upper:]" "[:lower:]")-amd64
chmod +x /usr/local/bin/talosctl
[root@localhost ~]# talosctl
A CLI for out-of-band management of Kubernetes nodes created by Talos
Usage:
talosctl [command]
Available Commands:
apply-config Apply a new configuration to a node
bootstrap Bootstrap the etcd cluster on the specified node.
cluster A collection of commands for managing local docker-based or QEMU-based clusters
completion Output shell completion code for the specified shell (bash, fish or zsh)
config Manage the client configuration file (talosconfig)
conformance Run conformance tests
containers List containers
copy Copy data out from the node
dashboard Cluster dashboard with real-time metrics
disks Get the list of disks from /sys/block on the machine
dmesg Retrieve kernel logs
edit Edit a resource from the default editor.
etcd Manage etcd
events Stream runtime events
gen Generate CAs, certificates, and private keys
get Get a specific resource or list of resources.
health Check cluster health
help Help about any command
images List the default images used by Talos
inspect Inspect internals of Talos
kubeconfig Download the admin kubeconfig from the node
list Retrieve a directory listing
logs Retrieve logs for a service
memory Show memory usage
mounts List mounts
patch Update field(s) of a resource using a JSON patch.
processes List running processes
read Read a file on the machine
reboot Reboot a node
reset Reset a node
restart Restart a process
rollback Rollback a node to the previous installation
service Retrieve the state of a service (or all services), control service state
shutdown Shutdown a node
stats Get container stats
support Dump debug information about the cluster
time Gets current server time
upgrade Upgrade Talos on the target node
upgrade-k8s Upgrade Kubernetes control plane in the Talos cluster.
usage Retrieve a disk usage
validate Validate config
version Prints the version
Flags:
--context string Context to be used in command
-e, --endpoints strings override default endpoints in Talos configuration
-h, --help help for talosctl
-n, --nodes strings target the specified nodes
--talosconfig string The path to the Talos configuration file (default "/root/.talos/config")
Use "talosctl [command] --help" for more information about a command.
2.创建集群Kubernetes
2.1安装kubectl
# 下载kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
# 下载kubectl校验文件
curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
# 校验文件
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check
# 安装
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
在 Linux 系统中安装并设置 kubectl | Kubernetes
2.2 创建Kubernetes集群
talosctl cluster create --wait
# 或者
talosctl cluster create
报错(未解决)
3.
4.集群清除
talosctl cluster destroy
Talos官方网站:Talos Linux