Quickly Deploy a Kubernetes Cluster with KubeKey: Step‑by‑Step Guide
This guide walks you through setting the download region, installing KubeKey and required dependencies, generating a configuration file, creating a single‑node or multi‑node Kubernetes cluster with containerd, and verifying the deployment using kubectl, all with clear command examples and screenshots.
Operation Steps
Official site: https://kubesphere.io/zh/
1. Execute the following commands to quickly create a Kubernetes cluster
Master node If access to GitHub/Googleapis is restricted, log into the Linux host and set the download region:
export KKZONE=cnMaster node Install the KubeKey tool:
curl -sfL https://get-kk.kubesphere.io | sh -The KubeKey binary kk will be generated in the current directory.
Each node Install required dependencies:
apt install socat conntrack -yMaster node Create a single‑node Kubernetes cluster (example with containerd):
./kk create cluster --with-local-storage --with-kubernetes v1.31.0 --container-manager containerd -yGenerate a KubeKey config template: ./kk create config Sample config-sample.yaml (excerpt):
apiVersion: kubekey.kubesphere.io/v1alpha2
kind: Cluster
metadata:
name: sample
spec:
hosts:
- {name: k8s-master, address: 11.0.1.10, internalAddress: 11.0.1.10, user: root, password: "000000"}
- {name: k8s-node01, address: 11.0.1.11, internalAddress: 11.0.1.11, user: root, password: "000000"}
- {name: k8s-node02, address: 11.0.1.12, internalAddress: 11.0.1.12, user: root, password: "000000"}
roleGroups:
etcd:
- k8s-master
control-plane:
- k8s-master
worker:
- k8s-node01
- k8s-node02
controlPlaneEndpoint:
domain: lb.kubesphere.local
address: ""
port: 6443
kubernetes:
version: v1.31.0
clusterName: cluster.local
autoRenewCerts: true
containerManager: docker
network:
plugin: calico
kubePodsCIDR: 10.233.64.0/18
kubeServiceCIDR: 10.233.0.0/18Create the cluster using the config file: ./kk create cluster config-sample.yaml The tool will check and install any missing dependencies.
Check Cluster Deployment Status
Run the following command to confirm that the cluster is fully deployed: kubectl get pod -A Sample output:
Cluster deployment is complete.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
