Centos7脚本一键快速安装单机版k8s

没有环境想迅速上手搞实验开发还是比较痛苦的,尤其是针对kubernetes这种庞大的系统,所以给出一个快速安装的教程是很有必要的。最近因项目需要,又从头搭了一遍kubernetes,结合网上的教程,找到了一个一键安装K8s的方法。

要求:CPU 2核,内存 4G,硬盘 20G,部署机器能访问外网

1、下载脚本

链接: https://pan.baidu.com/s/1l43GL1DBjX__wP-vu2z7cw?pwd=aq8p 提取码: aq8p

修改脚本k8s-mini-install.sh IP地址为本机的IP地址,例如192.168.31.223

sed -i "s/X.X.X.X/192.168.31.223/g" k8s-mini-install.sh

2、安装k8s

直接运行脚本

sh k8s-mini-install

中间出现如下内容时还没有安装成功,需要继续等待

[kubelet-finalize] Updating "/etc/kubernetes/kubelet.conf" to point to a rotatable kubelet client certificate and key
[addons] Applied essential addon: CoreDNS
[addons] Applied essential addon: kube-proxy
 
Your Kubernetes control-plane has initialized successfully!
 
To start using your cluster, you need to run the following as a regular user:
 
  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config
 
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  https://kubernetes.io/docs/concepts/cluster-administration/addons/
 
Then you can join any number of worker nodes by running the following on each as root:
 
kubeadm join 192.168.31.223:6443 --token qbrn22.mxfjjw1xbkdgxql5 \
    --discovery-token-ca-cert-hash sha256:6eb82d819dde170b314371fd860190ae6936818ee9fad0a818db192a3be819f3

此时继续等待,直到出现如下内容时,才安装结束

clusterrolebinding.rbac.authorization.k8s.io/calico-kube-controllers created
clusterrole.rbac.authorization.k8s.io/calico-node created
clusterrolebinding.rbac.authorization.k8s.io/calico-node created
daemonset.apps/calico-node created
serviceaccount/calico-node created
deployment.apps/calico-kube-controllers created
serviceaccount/calico-kube-controllers created
node/k8s-master untainted
NAME                                      READY   STATUS    RESTARTS   AGE
calico-kube-controllers-bc4f7c685-4c87x   1/1     Running   0          5m59s
calico-node-wvcrq                         1/1     Running   0          5m59s
coredns-6d56c8448f-82gpp                  1/1     Running   0          7m53s
coredns-6d56c8448f-n9lcg                  1/1     Running   0          7m53s
etcd-k8s-master                           1/1     Running   0          8m6s
kube-apiserver-k8s-master                 1/1     Running   0          8m6s
kube-controller-manager-k8s-master        1/1     Running   0          8m6s
kube-proxy-hhflg                          1/1     Running   0          7m53s
kube-scheduler-k8s-master                 1/1     Running   0          8m6s

3、验证安装结果

执行如下命令


kubectl get nodes

输出结果如下,说明安装成功。


NAME         STATUS   ROLES    AGE     VERSION
k8s-master   Ready    master   8m36s   v1.19.6
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇