文章目录
基于CentOS的KubeSphere安装
1.安装环境
配置 | 规格 |
---|---|
虚拟机 | VMware Workstation 15 pro |
CentOS镜像 | CentOS-7-x86_64-DVD-1810.iso |
CPU | 4核 |
内存 | 8G |
磁盘 | 100G |
2.环境配置
2.1 网络配置
修改网络配置文件
配置 | 参数 |
---|---|
IP | 10.0.0.22 |
子网掩码 | 255.255.255.0 |
网关 | 10.0.0.2 |
DNS | 114.114.114.114 |
vi /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
NAME=ens33
UUID=1ba18ba0-e159-498f-bd9c-4c19680b8608
DEVICE=ens33
ONBOOT=yes
IPADDR=10.0.0.22
NETMASK=255.255.255.0
GATEWAY=10.0.0.2
DNS1=114.114.114.114
重启网络
systemctl restart network
检查网络状态
systemctl status network
2.2 系统配置
2.2.1 关闭Selinux
2.2.1.1 检查Selinux是否开启
getenforce
如果系统回显如下,则跳过本节2.2.1
Disabled
2.2.1.2 关闭Selinux
- 临时关闭,无需重启机器
setenforce 0
- 永久关闭,需要重启机器
vi /etc/selinux/config
将“SELINUX=enforcing”改为“SELINUX=disabled”。
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
保存并退出。
重启主机
reboot
2.2.2 禁用NetworkManager
2.2.2.1 禁用NetworkManager
生产环境下一般使用手动配置网络,以静态地址为主不需要系统的网络管理工具,因此,将其禁用。
systemctl stop NetworkManager
systemctl disable NetworkManager
2.2.2.2 检查NetworkManager状态
systemctl status NetworkManager
回显如下内容,表示Networkmanager已禁用
● NetworkManager.service - Network Manager
Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; disabled; vendor preset: enabled)
Active: inactive (dead) since 三 2019-11-20 10:49:22 CST; 10s ago
Docs: man:NetworkManager(8)
Main PID: 8944 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/NetworkManager.service
└─9241 /sbin/dhclient -d -q -sf /usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-ens33.pid -lf /var/lib/NetworkManager/dhclient-1ba18ba0-e159-498f-bd9c-4c19680b8608-ens33.lease -cf /var/lib/Ne...
2.2.3 禁用firewall
2.2.3.1 禁用firewall
systemctl stop firewalld
systemctl disable firewalld
2.2.3.2 检查firewall状态
systemctl status firewalld
回显如下内容,表示firewall已禁用
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
2.2 Docker镜像下载
KubeSphere脚本默认会安装docker,但是镜像下载速度很慢,因此考虑使用阿里云镜像加速器;
配置加速器后,发现再执行KubeSphere安装脚本的时候Docker无法启动;
因此,先将镜像pull下来,再执行KubeSphere安装脚本
2.2.1 配置docker仓库
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
如果提示没有yum-config-manager工具,执行以下命令安装
sudo yum install yum-utils
2.2.2 安装docker
sudo yum install docker-ce
2.2.2 配置阿里云docker加速器
2.2.2.1 创建docker目录
sudo mkdir -p /etc/docker
2.2.2.2 创建daemon.json文件
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://xxxxxxx.mirror.aliyuncs.com"]
}
EOF
NOTE:xxxxxxx替换成自己申请的镜像地址
2.2.2.3 重启docker服务
sudo systemctl daemon-reload
sudo systemctl restart docker
2.2.2.4 检查docker服务是否正常
sudo systemctl status docker
2.2.2.5 提前下载docker镜像
docker pull ananwaresystems/webarchive:1.0
docker pull busybox:1.28.4
docker pull busybox:1.28.4
docker pull calico/cni:v3.7.3
docker pull calico/kube-controllers:v3.7.3
docker pull calico/node:v3.7.3
docker pull coredns/coredns:1.6.0
docker pull coredns/coredns:1.6.0
docker pull dockerhub.qingcloud.com/coreos/etcd:v3.2.18
docker pull dockerhub.qingcloud.com/google_containers/metrics-server-amd64:v0.3.1
docker pull dockerhub.qingcloud.com/kubernetes_ingress_controller/nginx-ingress-controller:0.24.1
docker pull dockerhub.qingcloud.com/pires/docker-elasticsearch-curator:5.5.4
docker pull emqx/emqx:latest
docker pull gcr.azk8s.cn/google-containers/hyperkube:v1.15.5
docker pull gcr.azk8s.cn/google-containers/k8s-dns-node-cache:1.15.5
docker pull gcr.azk8s.cn/google-containers/pause:3.1
docker pull gcr.azk8s.cn/kubernetes-helm/tiller:v2.14.3
docker pull gcr.azk8s.cn/kubernetes-helm/tiller:v2.14.3
docker pull haproxy:2.0.4
docker pull istio/citadel:1.3.3
docker pull istio/galley:1.3.3
docker pull istio/kubectl:1.3.3
docker pull istio/mixer:1.3.3
docker pull istio/pilot:1.3.3
docker pull istio/proxy_init:1.3.3
docker pull istio/proxyv2:1.3.3
docker pull istio/sidecar_injector:1.3.3
docker pull jaegertracing/jaeger-agent:1.13
docker pull jaegertracing/jaeger-collector:1.13
docker pull jaegertracing/jaeger-operator:1.13.1
docker pull jaegertracing/jaeger-query:1.13
docker pull jenkins/jenkins:2.176.2
docker pull jenkins/jnlp-slave:3.27-1
docker pull joosthofman/wget:1.0
docker pull kubesphere/addon-resizer:1.8.4
docker pull kubesphere/alert_adapter:v2.1.0
docker pull kubesphere/alerting-dbinit:v2.1.0
docker pull kubesphere/alerting:v2.1.0
docker pull kubesphere/builder-base:v2.1.0
docker pull kubesphere/builder-go:v2.1.0
docker pull kubesphere/builder-maven:v2.1.0
docker pull kubesphere/builder-nodejs:v2.1.0
docker pull kubesphere/configmap-reload:v0.0.1
docker pull kubesphere/elasticsearch-oss:6.7.0-1
docker pull kubesphere/examples-bookinfo-reviews-v1:1.13.0
docker pull kubesphere/fluent-bit:v1.3.2-reload
docker pull kubesphere/fluentbit-operator:v2.1.0
docker pull kubesphere/jenkins-uc:v2.1.0
docker pull kubesphere/ks-account:v2.1.0
docker pull kubesphere/ks-apigateway:v2.1.0
docker pull kubesphere/ks-apiserver:v2.1.0
docker pull kubesphere/ks-console:v2.1.0
docker pull kubesphere/ks-controller-manager:v2.1.0
docker pull kubesphere/ks-devops:flyway-v2.1.0
docker pull kubesphere/ks-installer:v2.1.0
docker pull kubesphere/kube-rbac-proxy:v0.4.1
docker pull kubesphere/kube-state-metrics:v1.5.2
docker pull kubesphere/log-sidecar-injector:1.0
docker pull kubesphere/node-exporter:ks-v0.16.0
docker pull kubesphere/notification:v2.1.0
docker pull kubesphere/prometheus-config-reloader:v0.27.1
docker pull kubesphere/prometheus-operator:v0.27.1
docker pull kubesphere/prometheus:v2.5.0
docker pull kubesphere/s2ioperator:v2.1.0
docker pull minio/minio:RELEASE.2019-08-07T01-59-21Z
docker pull mirrorgooglecontainers/addon-resizer:1.8.3
docker pull mirrorgooglecontainers/cluster-proportional-autoscaler-amd64:1.6.0
docker pull mirrorgooglecontainers/defaultbackend-amd64:1.4
docker pull mirrorgooglecontainers/metrics-server-amd64:v0.3.3
docker pull mirrorgooglecontainers/pause-amd64:3.1
docker pull mysql:5.6
docker pull mysql:8.0.11
docker pull nginx:1.14-alpine
docker pull nginxdemos/hello:plain-text
docker pull openpitrix/openpitrix:v0.4.5
docker pull openpitrix/release-app:v0.4.2
docker pull openpitrix/runtime-provider-kubernetes:v0.1.2
docker pull osixia/openldap:1.3.0
docker pull postgres:9.6.8
docker pull quay.azk8s.cn/coreos/etcd:v3.2.18
docker pull quay.azk8s.cn/openebs/node-disk-manager-amd64:v0.4.1
docker pull quay.azk8s.cn/openebs/node-disk-operator-amd64:v0.4.1
docker pull quay.io/jetstack/cert-manager-cainjector:v0.11.0
docker pull quay.io/jetstack/cert-manager-controller:v0.11.0
docker pull redis:5.0.5-alpine
docker pull sonarqube:7.4-community
docker pull tomcat:7.0
docker pull wordpress:4.8-apache
docker pull perl:latest
2.2.2.6 删除docker加速器配置文件
rm -rf /etc/docker/daemon.json
如果不删除,KubeSphere脚本安装过程中docker无法重启报错后面docker问题解决后,会及时更新博客
3.KubeSphere安装
3.1 下载安装包
下载 KubeSphere 2.1.0 安装包
curl -L https://kubesphere.io/download/stable/v2.1.0 > installer.tar.gz && tar -zxf installer.tar.gz && cd kubesphere-all-v2.1.0/scripts
3.2 执行安装
./install.sh
本文选择All in on模式
安装成功后,会出现下面的页面(包括控制台url、用户名和密码)
4.KubeSphere使用
4.1 登录
控制台:http://10.0.0.22:30880
用户名:admin
密码:P@88w0rd
通常10分钟内所有服务会起来