Kubesphere-多节点安装

  • 主机清单
  • 基础环境准备
    • 1. 安装docker
    • 2. 安装依赖
    • 3. 配置ssh互访
    • 4. 下载 KubeKey
  • 创建集群
    • 1. 创建示例配置文件
    • 2. 编辑配置文件
    • 3. 使用配置文件创建集群
  • 安装openelb
    • 1. 安装
    • 2. 启用strictARP
    • 3. 配置EIP
    • 4. 如何使用
      • 1. 创建deployment
      • 2. 创建service
      • 3. 验证

主机清单

序号 IP 主机名 配置
1 192.168.85.161 k8s-master 8VCPU 32GB
2 192.168.85.162 k8s-node1 8VCPU 32GB
3 192.168.85.163 k8s-node2 8VCPU 32GB
4 192.168.85.164 nfs-server 8VCPU 32GB

基础环境准备

nfs服务器安装部署(略)

1. 安装docker

curl -sSL https://get.daocloud.io/docker | sh
# 加速
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io

2. 安装依赖

yum -y install socat conntrack ebtables ipset net-tools

3. 配置ssh互访

# 所有节点上执行
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.85.161
ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.85.162
ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.85.163

4. 下载 KubeKey

# 只在master上执行即可
export KKZONE=cn
curl -sfL https://get-kk.kubesphere.io | VERSION=v2.0.0 sh -

创建集群

1. 创建示例配置文件

./kk create config --with-kubesphere

2. 编辑配置文件

插件根据使用情况和服务器资源大小,自行安装。

apiVersion: kubekey.kubesphere.io/v1alpha2
kind: Cluster
metadata:name: sample
spec:hosts:   # 配置主机清单- {name: k8s-master, address: 192.168.85.161, internalAddress: 192.168.85.161, privateKeyPath: "~/.ssh/id_rsa"}- {name: k8s-node1, address: 192.168.85.162, internalAddress: 192.168.85.162, privateKeyPath: "~/.ssh/id_rsa"}- {name: k8s-node2, address: 192.168.85.163, internalAddress: 192.168.85.163, privateKeyPath: "~/.ssh/id_rsa"}roleGroups:etcd:    # etcd 节点列表- k8s-master  control-plane:    # 主机节点列表- k8s-master  worker:    # 工作节点列表- k8s-node1- k8s-node2controlPlaneEndpoint:## Internal loadbalancer for apiservers # internalLoadbalancer: haproxydomain: lb.kubesphere.localaddress: ""port: 6443kubernetes:version: v1.21.5clusterName: cluster.localnetwork:plugin: calicokubePodsCIDR: 10.233.64.0/18kubeServiceCIDR: 10.233.0.0/18multusCNI:enabled: falseregistry:plainHTTP: falseprivateRegistry: ""namespaceOverride: ""registryMirrors: []insecureRegistries: []addons: - name: nfs-client    # 使用nfs作为持久化存储namespace: kube-systemsources: chart: name: nfs-client-provisionerrepo: https://charts.kubesphere.io/mainvalues:- storageClass.defaultClass=true- nfs.server=192.168.85.164- nfs.path=/data---
apiVersion: installer.kubesphere.io/v1alpha1
kind: ClusterConfiguration
metadata:name: ks-installernamespace: kubesphere-systemlabels:version: v3.2.1
spec:persistence:storageClass: ""authentication:jwtSecret: ""local_registry: ""namespace_override: ""# dev_tag: ""etcd:monitoring: true  # 根据情况决定是否开启endpointIps: localhostport: 2379tlsEnable: truecommon:core:console:enableMultiLogin: trueport: 30880type: NodePort# apiserver:#  resources: {}# controllerManager:#  resources: {}redis:enabled: true  # 根据情况决定是否开启volumeSize: 2Giopenldap:enabled: true  # 根据情况决定是否开启volumeSize: 2Giminio:volumeSize: 20Gimonitoring:# type: externalendpoint: http://prometheus-operated.kubesphere-monitoring-system.svc:9090GPUMonitoring:enabled: true  # 根据情况决定是否开启gpu:kinds:         - resourceName: "nvidia.com/gpu"resourceType: "GPU"default: truees:# master:#   volumeSize: 4Gi#   replicas: 1#   resources: {}# data:#   volumeSize: 20Gi#   replicas: 1#   resources: {}logMaxAge: 7elkPrefix: logstashbasicAuth:enabled: false  # 是否使用验证username: ""password: ""externalElasticsearchHost: ""externalElasticsearchPort: ""alerting:enabled: true  # 根据情况决定是否开启# thanosruler:#   replicas: 1#   resources: {}auditing:enabled: true  # 根据情况决定是否开启# operator:#   resources: {}# webhook:#   resources: {}devops:enabled: true  # 根据情况决定是否开启jenkinsMemoryLim: 2GijenkinsMemoryReq: 1500MijenkinsVolumeSize: 8GijenkinsJavaOpts_Xms: 512mjenkinsJavaOpts_Xmx: 512mjenkinsJavaOpts_MaxRAM: 2gevents:enabled: true# operator:#   resources: {}# exporter:#   resources: {}# ruler:#   enabled: true#   replicas: 2#   resources: {}logging:enabled: truecontainerruntime: dockerlogsidecar:enabled: truereplicas: 2# resources: {}metrics_server:enabled: truemonitoring:storageClass: ""# kube_rbac_proxy:#   resources: {}# kube_state_metrics:#   resources: {}# prometheus:#   replicas: 1#   volumeSize: 20Gi#   resources: {}#   operator:#     resources: {}#   adapter:#     resources: {}# node_exporter:#   resources: {}# alertmanager:#   replicas: 1#   resources: {}# notification_manager:#   resources: {}#   operator:#     resources: {}#   proxy:#     resources: {}gpu:nvidia_dcgm_exporter:enabled: true# resources: {}multicluster:clusterRole: none network:networkpolicy:enabled: trueippool:type: nonetopology:type: noneopenpitrix:store:enabled: falseservicemesh:enabled: truekubeedge:enabled: false   cloudCore:nodeSelector: {"node-role.kubernetes.io/worker": ""}tolerations: []cloudhubPort: "10000"cloudhubQuicPort: "10001"cloudhubHttpsPort: "10002"cloudstreamPort: "10003"tunnelPort: "10004"cloudHub:advertiseAddress:- ""nodeLimit: "100"service:cloudhubNodePort: "30000"cloudhubQuicNodePort: "30001"cloudhubHttpsNodePort: "30002"cloudstreamNodePort: "30003"tunnelNodePort: "30004"edgeWatcher:nodeSelector: {"node-role.kubernetes.io/worker": ""}tolerations: []edgeWatcherAgent:nodeSelector: {"node-role.kubernetes.io/worker": ""}tolerations: []

3. 使用配置文件创建集群

./kk create cluster -f config-sample.yaml
  1. 验证安装

安装完成后,您会看到如下内容:

#####################################################
###              Welcome to KubeSphere!           ###
#####################################################Console: http://192.168.85.161:30880
Account: admin
Password: P@88w0rdNOTES:1. After you log into the console, please check themonitoring status of service components in"Cluster Management". If any service is notready, please wait patiently until all componentsare up and running.2. Please change the default password after login.#####################################################
https://kubesphere.io             2022-07-28 03:10:29
#####################################################

安装openelb

1. 安装

kubectl apply -f https://raw.githubusercontent.com/openelb/openelb/master/deploy/openelb.yaml

2. 启用strictARP

需要为 kube-proxy 启用 strictARP,以便 Kubernetes 集群中的所有网卡停止响应其他网卡的 ARP 请求,而由 OpenELB 处理 ARP 请求。

kubectl edit configmap kube-proxy -n kube-system
...
ipvs:strictARP: true
...

然后执行下面的命令重启 kube-proxy 组件即可:

kubectl rollout restart daemonset kube-proxy -n kube-system

3. 配置EIP

apiVersion: network.kubesphere.io/v1alpha2
kind: Eip
metadata:name: eip-poolannotations:eip.openelb.kubesphere.io/is-default-eip: "true"
spec:address: 192.168.85.91-192.168.85.100  # 地址池protocol: layer2  # 协议:BGP, Layer 2, or VIPinterface: eth0  # 网卡disable: false

4. 如何使用

1. 创建deployment

  1. 创建yaml文件
vi layer2-openelb.yaml
  1. 写入以下内容
apiVersion: apps/v1
kind: Deployment
metadata:name: layer2-openelb
spec:replicas: 2selector:matchLabels:app: layer2-openelbtemplate:metadata:labels:app: layer2-openelbspec:containers:- image: luksa/kubianame: kubiaports:- containerPort: 8080
  1. 应用yaml文件创建deployment
kubectl apply -f layer2-openelb.yaml

2. 创建service

  1. 创建yaml文件
vi layer2-svc.yaml
  1. 写入以下内容
kind: Service
apiVersion: v1
metadata:name: layer2-svcannotations:  # 需要添加以下3个注解lb.kubesphere.io/v1alpha1: openelbprotocol.openelb.kubesphere.io/v1alpha1: layer2eip.openelb.kubesphere.io/v1alpha2: eip-pool  # eip地址池名称
spec:selector:app: layer2-openelbtype: LoadBalancerports:- name: httpport: 80targetPort: 8080externalTrafficPolicy: Cluster
  1. 应用yaml文件创建service
kubectl apply -f layer2-svc.yaml

3. 验证

[root@k8s-master ~]# kubectl get svc
NAME         TYPE           CLUSTER-IP      EXTERNAL-IP     PORT(S)        AGE
kubernetes   ClusterIP      10.233.0.1      <none>          443/TCP        34m
layer2-svc   LoadBalancer   10.233.49.106   192.168.85.91   80:31929/TCP   4s[root@k8s-master ~]# curl 192.168.85.91
You've hit layer2-openelb-7b4fdf6f85-nvsws

Kubesphere-多节点安装相关推荐

  1. kubesphere多节点安装出错

    kubesphere多节点安装(官方参考https://kubesphere.io/zh/docs/installing-on-linux/introduction/multioverview/) 1 ...

  2. 运维(36) CentOS7.6 多节点安装KubeSphere

    文章目录 一.前言 二.环境准备 1.配置主机名 2.安装相关依赖项 三.安装KubeSphere 1.下载KubeKey 2.创建集群配置文件 3.使用配置文件创建集群 4.验证安装 5.访问 四. ...

  3. 【尚硅谷云原生Java架构师的第一课 4 2021-09-28】KubeSphere三种安装,docker,k8s,nfs安装,metrics。KubeKey一键单 多节点安装。

    1.KubeSphere https://www.yuque.com/leifengyang/oncloud/gz1sls 介绍 sphere 英 /sfɪə(r)/ n. (活动.兴趣.专业知识的) ...

  4. KubeSphere 虚拟化 KSV 安装体验

    KSV 简介 KubeSphere 虚拟化(KSV) 是一个轻量化的虚拟机管理平台,支持单节点和多节点部署,简单易用,KSV 采用前后端分离的架构,实现了面向云原生的设计,各个模块松耦合设计,作为企业 ...

  5. [云原生专题-61]:Kubesphere云治理-安装(3)-可插拔组件的安装

    作者主页(文火冰糖的硅基工坊):文火冰糖(王文兵)的博客_文火冰糖的硅基工坊_CSDN博客 本文网址:https://blog.csdn.net/HiWangWenBing/article/detai ...

  6. 02.Kubernetes 和 KubeSphere 集群安装配置持久化存储(nfs)并通过StatefulSet动态为pod生成pv挂载

    Kubernetes 和 KubeSphere 集群安装配置持久化存储(nfs)并通过StatefulSet动态为pod生成pv挂载 简介 1. 安装配置前置环境 1.1 安装nfs文件系统 1.1. ...

  7. [Ubuntu 12.10] Openstack 多节点安装--前期准备网络拓扑

    为什么80%的码农都做不了架构师?>>>    研究openstack也有一段时间了,写了一大堆笔记都没整理,最近要把开发机迁移到openstack上试试,安装一个多节点玩玩,也方便 ...

  8. ubuntu多节点安装kubernetes

    在ubuntu上面多节点安装kubernetes,假设有两台机器 master:192.168.1.84 minion:192.168.1.83 You wil now need to configu ...

  9. Docker安装zookeeper 单节点安装

    基于Docker安装zookeeper 一.单节点安装 拉取最新版本 docker pull zookeeper 启动zookeeper并添加映射 语法:docker run --privileged ...

最新文章

  1. [转]mysql使用关键字作为列名的处理方式
  2. WinsockExpert+NC抓包上传之拿WEBSHELL
  3. android 字符串的拆分
  4. 基于c语言单片机秒表课程设计,基于c语言单片机秒表课程设计要点.doc
  5. java里面如何加入高级的东西_如何成为一名Java高级架构师
  6. 动态改变类名_反调试之检测类名与标题名
  7. java抽象类代码_java – 抽象类和通用代码
  8. 数据结构线性表的三个属性
  9. WorldWind学习系列六:渲染过程解析篇
  10. 大哥吾博文写得清清楚楚,怎么就不试一下?
  11. Softmax 回归 + 损失函数 + 图片分类数据集 动手学深度学习v2 pytorch
  12. 简析:世博会燃印刷业激情
  13. yoga710怎么进入bios_联想_ThinkPad|ThinkCentre|ThinkStation服务与驱动下载_常见问题
  14. 基于嵌入式Linux的语音识别系统硬软件设计
  15. python求积分面积的几个方法
  16. 计算机组装与维护毕业论文参考文献,计算机组装与维护本科毕业论文毕业论文.doc...
  17. WTEM-1Q/GPS瞬变电磁仪操作步骤
  18. Windows Project2016如何增加加班工时。
  19. STM8S自学笔记之利用库函数点亮一个LED
  20. 用IntelliJ IDEA开发Python

热门文章

  1. curl常用参数详解及示例
  2. 房屋翻新步骤有哪些?极家装修怎么样?
  3. 国际大会演讲ppt_2008年上半年会议演讲时间表
  4. 打造自己的游戏修改器和内存补丁
  5. 大富翁11 V1.0.7 官方中文绿色免安装版
  6. 3DMAX、C4D、Maya导出fbx到Unity设置
  7. 自动代理老是自动打开上不了网的解决办法
  8. edge的扩展插件如何在chrome里面使用?
  9. 神通数据库connect by用法
  10. 数据分析和数据挖掘的概念和理念