k8s以及kubesphere部署
本次部署采用官方离线方式,部署一个k8s集群以及它的可视化页面,在阅读本博客前请先准备3台虚拟机或服务器,具体要求如下:master: 内存4G处理器:2核硬盘:50Gnode1: 内存4G处理器:2核硬盘:50Gnode2: 内存4G处理器:2核硬盘:50G这些准备好之后方可进行安装配置静态ip设置主机名#master节点hostnamectlset-hostnamemaster#node1节点
·
本次部署采用官方离线方式,部署一个k8s集群以及它的可视化页面,在阅读本博客前请先准备3台虚拟机或服务器,具体要求如下:
master: 内存4G 处理器:2核 硬盘:50G
node1: 内存4G 处理器:2核 硬盘:50G
node2: 内存4G 处理器:2核 硬盘:50G
这些准备好之后方可进行安装
- 配置静态ip
- 设置主机名
#master节点
hostnamectl set-hostname master
#node1节点
hostnamectl set-hostname node1
#node2节点
hostnamectl set-hostname node2
- 设置域名
[root@master ~]# vim /etc/hosts
# 添加如下3行
10.4.3.91 master
10.4.3.81 node1
10.4.3.82 node2
# 其他的2个node节点也需要同样操作
- 关闭防火墙和禁止防火墙开机启动
systemctl stop firewalld
systemctl disable firewalld
5.时间同步
yum install ntpdate -y
ntpdate time.windows.com
6.设置时区
timedatectl set-timezone Asia/Shangha
7.关机重启
8. 然后参照官方文档开始安装
- 下载KubeKey
# 获取访问权限
export KKZONE=cn
#开始下载kk
curl -sfL https://get-kk.kubesphere.io | VERSION=v1.1.1 sh -
#为kk添加执行权限
chmod +x kk
2.创建集群配置文件,他会下载一个config-sample.yaml的文件
./kk create config --with-kubernetes v1.20.4 --with-kubesphere v3.1.1
3.修改config-sample.yaml文件
apiVersion: kubekey.kubesphere.io/v1alpha1
kind: Cluster
metadata:
name: sample
spec:
hosts:
- {name: master, address: 10.140.126.6, internalAddress: 10.140.126.6, user: root, password: Hello777}
- {name: node1, address: 10.140.122.56, internalAddress: 10.140.122.56, user: root, password: Hello777}
- {name: node2, address: 10.140.122.39, internalAddress: 10.140.122.39, user: root, password: Hello777}
roleGroups:
etcd:
- master
master:
- master
worker:
- node1
- node2
controlPlaneEndpoint:
domain: lb.kubesphere.local
address: ""
port: 6443
kubernetes:
version: v1.20.4
imageRepo: kubesphere
clusterName: cluster.local
network:
plugin: calico
kubePodsCIDR: 10.233.64.0/18
kubeServiceCIDR: 10.233.0.0/18
registry:
registryMirrors: []
insecureRegistries: []
addons: []
---
apiVersion: installer.kubesphere.io/v1alpha1
kind: ClusterConfiguration
metadata:
name: ks-installer
namespace: kubesphere-system
labels:
version: v3.1.1
spec:
persistence:
storageClass: ""
authentication:
jwtSecret: ""
zone: ""
local_registry: ""
etcd:
monitoring: false
endpointIps: localhost
port: 2379
tlsEnable: true
common:
redis:
enabled: false
redisVolumSize: 2Gi
openldap:
enabled: false
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: false
# thanosruler:
# replicas: 1
# resources: {}
auditing:
enabled: false
devops:
enabled: false
jenkinsMemoryLim: 2Gi
jenkinsMemoryReq: 1500Mi
jenkinsVolumeSize: 8Gi
jenkinsJavaOpts_Xms: 512m
jenkinsJavaOpts_Xmx: 512m
jenkinsJavaOpts_MaxRAM: 2g
events:
enabled: false
ruler:
enabled: true
replicas: 2
logging:
enabled: false
logsidecar:
enabled: true
replicas: 2
metrics_server:
enabled: false
monitoring:
storageClass: ""
prometheusMemoryRequest: 400Mi
prometheusVolumeSize: 20Gi
multicluster:
clusterRole: none
network:
networkpolicy:
enabled: false
ippool:
type: none
topology:
type: none
openpitrix:
store:
enabled: false
servicemesh:
enabled: false
kubeedge:
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: []
所选位置都改成自己的.
4. 执行安装
./kk create cluster -f config-sample.yaml
5.等待几个小时候就可以了,全程无需操作,如果因网络原因资源下载失败,可以重新执行这个文件,下载过的他就会跳过.可以使用以下命令查看安装进度
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
更多推荐
已为社区贡献2条内容
所有评论(0)