Kubekey安装Kubernetes-1.24.8的过程介绍

专为编程打造,自动写代码机器人,免费开通

本篇文章和大家了解一下Kubekey安装Kubernetes-1.24.8的过程介绍。有一定的参考价值,有需要的朋友可以参考一下,希望对大家有所帮助。


master节点

    • 12.验证-master节点

Kubekey简介

官网文档:https://kubesphere.com.cn/docs/v3.3/installing-on-linux/introduction/kubekey/

Github:https://github.com/kubesphere/kubekey

Github中文文档:https://github.com/kubesphere/kubekey/blob/master/README_zh-CN.md

Kubekey采用Go编写,不像Ansible那样依赖运行环境,可以同时安装 Kubernetes 和 KubeSphere。此外Kubekey还可以对K8S集群做升级、扩缩容、根据Yaml安装插件等操作,对非专业运维的开发人员相当友好。

多节点安装K8S及KubeSphere官方文档:https://kubesphere.com.cn/docs/v3.3/installing-on-linux/introduction/multioverview/

Kubekey安装Kubernetes-1.24.8 0.

0.系统环境

  • 主机:3台虚拟机 4C8G

  • 系统:CentOS-7.9

  • 完成环境:kubernetes-1.24.8,容器:containerd

1.hostname-所有节点

hostnamectl set-hostname l-master
hostnamectl set-hostname l-worker-01
hostnamectl set-hostname l-worker-02

2.hosts-所有节点

192.168.31.66   l-master
192.168.31.67   l-worker-01
192.168.31.68   l-worker-02

3.yum安装依赖-所有节点

yum install -y update 
yum install -y wget && yum install -y vim && yum install -y lsof && yum install -y net-tools

4.关闭防火墙-所有节点

systemctl stop firewalld
systemctl disable firewalld

5.关闭 selinux-所有节点

sed -i 's/enforcing/disabled/' /etc/selinux/config
setenforce 0
cat /etc/selinux/config

6.关闭 swap-所有节点

swapoff -a
sed -ri 's/.*swap.*/#&/' /etc/fstab
free -l -h

7.安装依赖组件### 安装依赖组件-所有节点

yum install -y ebtables socat ipset conntrack

8.安装其他依赖于时间同步-所有节点

yum install -y ebtables socat ipset conntrack

9.下载kk-master节点

mkdir /opt/kubesphere
cd /opt/kubesphere
export KKZONE=cn
curl -sfL https://get-kk.kubesphere.io | VERSION=v3.0.7 sh -

10.准备配置文件-master节点

cat /opt/kubesphere/k8s-config.yaml

apiVersion: kubekey.kubesphere.io/v1alpha2
kind: Cluster
metadata:
  name: sample
spec:
  hosts:
  - {name: l-master, address: 192.168.31.66, internalAddress: 192.168.31.66, user: root, password: "root"}
  - {name: l-worker-01, address: 192.168.31.67, internalAddress: 192.168.31.67, user: root, password: "root"}
  - {name: l-worker-02, address: 192.168.31.68, internalAddress: 192.168.31.68, user: root, password: "root"}
  roleGroups:
    etcd:
    - l-master
    control-plane: 
    - l-master
    worker:
    - l-master
    - l-worker-01
    - l-worker-02
  controlPlaneEndpoint:
    ## Internal loadbalancer for apiservers 
    # internalLoadbalancer: haproxy
    domain: lb.kubesphere.local
    address: ""
    port: 6443
  kubernetes:
    version: v1.24.8
    clusterName: cluster.local
    autoRenewCerts: true
    containerManager: docker
  etcd:
    type: kubekey
  network:
    plugin: calico
    kubePodsCIDR: 10.233.64.0/18
    kubeServiceCIDR: 10.233.0.0/18
    ## multus support. https://github.com/k8snetworkplumbingwg/multus-cni
    multusCNI:
      enabled: false
  registry:
    privateRegistry: ""
    namespaceOverride: ""
    registryMirrors: []
    insecureRegistries: []
  addons: []

11.执行安装-master节点

./kk create cluster -f k8s-config.yaml -y --container-manager containerd

12.验证-master节点

kubectl get pod -A

kube-system   calico-kube-controllers-676c86494f-5lr5w             1/1     Running   1 (50m ago)   4h45m
kube-system   calico-node-c79sk                                    1/1     Running   1 (50m ago)   4h45m
kube-system   calico-node-mkmdg                                    1/1     Running   1 (50m ago)   4h45m
kube-system   calico-node-p55pb                                    1/1     Running   1 (50m ago)   4h45m
kube-system   coredns-757cd945b-9crbl                              1/1     Running   1 (50m ago)   4h45m
kube-system   coredns-757cd945b-pw9qc                              1/1     Running   1 (50m ago)   4h45m
kube-system   kube-apiserver-b-master                              1/1     Running   1 (50m ago)   4h45m
kube-system   kube-controller-manager-b-master                     1/1     Running   1 (50m ago)   4h45m
kube-system   kube-proxy-2vnlb                                     1/1     Running   1 (50m ago)   4h45m
kube-system   kube-proxy-5tv62                                     1/1     Running   1 (50m ago)   4h45m
kube-system   kube-proxy-vckp4                                     1/1     Running   1 (50m ago)   4h45m
kube-system   kube-scheduler-b-master                              1/1     Running   1 (50m ago)   4h45m
kube-system   nodelocaldns-5jwdf                                   1/1     Running   1 (50m ago)   4h45m
kube-system   nodelocaldns-p99zp                                   1/1     Running   1 (50m ago)   4h45m
kube-system   nodelocaldns-xbvfk                                   1/1     Running   1 (50m ago)   4h45m

以上就是Kubekey安装Kubernetes-1.24.8的过程介绍的简略介绍,当然详细使用上面的不同还得要大家自己使用过才领会。如果想了解更多,欢迎关注蜗牛博客行业资讯频道哦!

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:niceseo6@gmail.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

评论

有免费节点资源,我们会通知你!加入纸飞机订阅群

×
天气预报查看日历分享网页手机扫码留言评论Telegram