1. 准备1.1 配置NFS2. 安装2.1 准备KubeKey2.2 创建集群2.3 创建集群添加NFS2.4 安装对应文件2.5 安装完成 2.5.1 安装成功显示2.5.2 查看组件安装进度2.5.3 查看Pods2.6 访问
1. 准备
1.1 配置NFS
- 准备好 nfs 存储服务
- config-sample.yaml 添加如下对接nfs存储
addons: - name: nfs-client namespace: kube-system sources: chart: name: nfs-client-provisioner path: /root/kubesphere-all-v3.1.1-offline-linux-amd64/charts values: - nfs.server=192.168.0.22 - nfs.path=/mnt/kube - image.repository=registry.cn-beijing.aliyuncs.com/kubesphereio/nfs-subdir-external-provisioner - image.tag=v4.0.2 - storageClass.defaultClass=true
请特别注意
addons
字段,您必须在该字段下提供 NFS-client 的信息。2. 安装
2.1 准备KubeKey
export KKZONE=cn curl -sfL https://get-kk.kubesphere.io | VERSION=v1.1.1 sh - chmod +x kk
2.2 创建集群
- 指定
kubernetes
、kubesphere
版本
./kk create config --with-kubernetes v1.20.4 --with-kubesphere v3.1.1
2.3 创建集群
主节点运行
vim config-sample.yaml
config-sample.yaml
文件,修改以下参数修改参数
- name
- address
- internalAddress
- user
修改参数
- password
- etcd
- master
- worker
apiVersion: kubekey.kubesphere.io/v1alpha1 kind: Cluster metadata: name: sample spec: hosts: - {name: master, address: 192.168.92.142, internalAddress: 192.168.92.142, user: root, password: root} - {name: node1, address: 192.168.92.143, internalAddress: 192.168.92.143, user: root, password: root} - {name: node2, address: 192.168.92.144, internalAddress: 192.168.92.144, user: root, password: root} roleGroups: etcd: - master master: - master worker: - node1 - node2 controlPlaneEndpoint: domain: lb.kubesphere.local address: "" port: 6443 kubernetes: version: v1.21.5 imageRepo: kubesphere clusterName: cluster.local network: plugin: calico kubePodsCIDR: 10.233.64.0/18 kubeServiceCIDR: 10.233.0.0/18 registry: registryMirrors: [] insecureRegistries: [] addons: - name: nfs-client namespace: kube-system sources: chart: name: nfs-client-provisioner repo: https://charts.kubesphere.io/main values: - storageClass.defaultClass=true - nfs.server=192.168.92.142 - nfs.path=/nfs/data --- apiVersion: installer.kubesphere.io/v1alpha1 kind: ClusterConfiguration metadata: name: ks-installer namespace: kubesphere-system labels: version: v3.2.0 spec: persistence: storageClass: "" authentication: jwtSecret: "" zone: "" local_registry: "" etcd: monitoring: true endpointIps: 192.168.92.142 port: 2379 tlsEnable: true common: redis: enabled: true redisVolumSize: 2Gi openldap: enabled: true openldapVolumeSize: 2Gi minioVolumeSize: 20Gi monitoring: endpoint: http://prometheus-operated.kubesphere-monitoring-system.svc:9090 es: elasticsearchMasterVolumeSize: 4Gi elasticsearchDataVolumeSize: 20Gi logMaxAge: 7 elkPrefix: logstash basicAuth: enabled: false username: "" password: "" externalElasticsearchUrl: "" externalElasticsearchPort: "" console: enableMultiLogin: true port: 30880 alerting: enabled: true # thanosruler: # replicas: 1 # resources: {} auditing: enabled: true devops: enabled: true jenkinsMemoryLim: 2Gi jenkinsMemoryReq: 1500Mi jenkinsVolumeSize: 8Gi jenkinsJavaOpts_Xms: 512m jenkinsJavaOpts_Xmx: 512m jenkinsJavaOpts_MaxRAM: 2g events: enabled: true ruler: enabled: true replicas: 2 logging: enabled: true logsidecar: enabled: true replicas: 2 metrics_server: enabled: false monitoring: storageClass: "" prometheusMemoryRequest: 400Mi prometheusVolumeSize: 20Gi multicluster: clusterRole: none network: networkpolicy: enabled: true ippool: type: calico topology: type: none openpitrix: store: enabled: true servicemesh: enabled: true kubeedge: enabled: true 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: []
参数说明
修改
cluster-configuration.yaml
内容,用到那个功能将false
改为true
打开即可。- 监控功能
- 系统告诫功能
- devops功能
- 日志功能
- ippool:none—>calico
- kubeedge边缘计算
- redis功能
- 轻量级目录协议
- 审计功能
- 集群的事件功能
- 网络策略
- 应用商店
- 微服务治理功能
添加NFS
config-sample.yaml
,addons添加如下对接nfs存储
addons: - name: nfs-client namespace: kube-system sources: chart: name: nfs-client-provisioner repo: https://charts.kubesphere.io/main values: - storageClass.defaultClass=true - nfs.server=192.168.92.142 - nfs.path=/nfs/data
请特别注意
addons
字段,您必须在该字段下提供 NFS-client 的信息。./kk create cluster -f config-sample.yaml
2.4 安装对应文件
三个节点安装
root@master:~# sudo apt-get install conntrack
创建,主节点运行
./kk create cluster -f config-sample.yaml
2.5 安装完成
2.5.1 安装成功显示
2.5.2 查看组件安装进度
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
2.5.3 查看Pods
kubectl get pod -A
2.6 访问
Account: admin
Password: P@88w0rd