Download KubeKey

KubeKey is a new generation of Kubernetes and KubeSphere installer to help you install Kubernetes and KubeSphere in a simple, fast and flexible way.

Export KKZONE = cn curl - sfL https://get-kk.kubesphere.io | VERSION = v1.0.1 sh -Copy the code

Prepare the mirror

If you want to speed up the installation or your computer room does not have the Internet, you can use the company’s internal private warehouse to push the image to the private warehouse in advance. My warehouse uses harbor to download the offline installation tool, while I just use this script to download and push the image

The curl curl - L - O https://github.com/kubesphere/ks-installer/releases/download/v3.0.0/offline-installation-tool.sh - L - O https://github.com/kubesphere/ks-installer/releases/download/v3.0.0/images-list.txtCopy the code

Pull the mirror

Sh -s -l images-list. TXT -d./kubesphere-images # ll total 8606088 -rw-r--r-- 1 root root 454465957 Feb 2 15:37 csi-images.tar.gz -rw-r--r-- 1 root root 1231853258 Feb 2 15:33 example-images.tar.gz -rw-r--r-- 1 root root 445244294 Feb 2 14:50 istio-images.tar.gz -rw-r--r-- 1 root root 762326634 Feb 2 14:27 k8s-images.tar.gz -rw-r--r-- 1 root root 1297767607 Feb 2 14:40 ks-core-images.tar.gz -rw-r--r-- 1 root root  3439146357 Feb 2 15:19 ks-devops-images.tar.gz -rw-r--r-- 1 root root 733165078 Feb 2 14:46 ks-logging-images.tar.gz -rw-r--r-- 1 root root 448651153 Feb 2 15:23 openpitrix-images.tar.gzCopy the code

Push the image to a private repository and wait for the script to complete

./offline-installation-tool.sh -l images-list.txt -d ./kubesphere-images -r hub.evbj.easou.com
Copy the code

Create a multi-node cluster

You can use KubeKey to install Kubernetes and KubeSphere at the same time, creating a multi-node cluster using parameters in a custom configuration file. Create Kubernetes cluster with KubeSphere installed (for example –with-kubesphere v3.0.0)

/kk create config --with-kubernetes v1.17.9 --with-kubesphere v3.0.0./kk create config --with-kubernetes v1.17.9 --with-kubesphere v3.0.0Copy the code

The default config-sample.yaml file will be created. You can modify this file according to your environment.

apiVersion: kubekey.kubesphere.io/v1alpha1
kind: Cluster
metadata:
  name: ESCloud
spec:
  hosts:
  - {name: kubesphere001.address: 10.2631.34..internalAddress: 10.2631.34..privateKeyPath: "~/.ssh/id_dsa".port: 20755}
  - {name: kubesphere002.address: 10.2631.36..internalAddress: 10.2631.36..privateKeyPath: "~/.ssh/id_dsa".port: 20755}
  - {name: kubesphere003.address: 10.2631.42..internalAddress: 10.2631.42..privateKeyPath: "~/.ssh/id_dsa".port: 20755}
  - {name: kubesphere004.address: 10.2631.46..internalAddress: 10.2631.46..privateKeyPath: "~/.ssh/id_dsa".port: 20755}
  - {name: kubesphere005.address: 10.2631.118..internalAddress: 10.2631.118..privateKeyPath: "~/.ssh/id_dsa".port: 20755}
  - {name: kubesphere006.address: 10.2631.119..internalAddress: 10.2631.119..privateKeyPath: "~/.ssh/id_dsa".port: 20755}
  - {name: kubesphere007.address: 10.2631.120..internalAddress: 10.2631.120..privateKeyPath: "~/.ssh/id_dsa".port: 20755}
  - {name: kubesphere008.address: 10.2631.121..internalAddress: 10.2631.121..privateKeyPath: "~/.ssh/id_dsa".port: 20755}
  roleGroups:
    etcd:
    - kubesphere001
    - kubesphere002
    - kubesphere003
    master: 
    - kubesphere001
    - kubesphere002
    - kubesphere003
    worker:
    - kubesphere004
    - kubesphere005
    - kubesphere006
    - kubesphere007
    - kubesphere008
  controlPlaneEndpoint:
    domain: lb.kubesphere.local
    address: ""
    port: "6443"
  kubernetes:
    version: v1.17.9
    imageRepo: kubesphere
    clusterName: cluster.local
  network:
    plugin: calico
    kubePodsCIDR: 10.23364.. 0/ 18
    kubeServiceCIDR: 10.233. 0. 0/ 18
  registry:
    registryMirrors: []
    insecureRegistries: ["hub.kubeops.net"]
    privateRegistry: "hub.kubeops.net"
  addons: []


---
apiVersion: installer.kubesphere.io/v1alpha1
kind: ClusterConfiguration
metadata:
  name: ks-installer
  namespace: kubesphere-system
  labels:
    version: v3.0.0
spec:
  local_registry: "hub.kubeops.net"
  persistence:
    storageClass: ""
  authentication:
    jwtSecret: ""
  etcd:
    monitoring: true
    endpointIps: localhost
    port: 2379
    tlsEnable: true
  common:
    es:
      elasticsearchDataVolumeSize: 20Gi
      elasticsearchMasterVolumeSize: 4Gi
      elkPrefix: logstash
      logMaxAge: 7
    mysqlVolumeSize: 20Gi
    minioVolumeSize: 20Gi
    etcdVolumeSize: 20Gi
    openldapVolumeSize: 2Gi
    redisVolumSize: 2Gi
  console:
    enableMultiLogin: true  # enable/disable multi login
    port: 30880
  alerting:
    enabled: false
  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
    logsidecarReplicas: 2
  metrics_server:
    enabled: true
  monitoring:
    prometheusMemoryRequest: 400Mi
    prometheusVolumeSize: 20Gi
  multicluster:
    clusterRole: none  # host | member | none
  networkpolicy:
    enabled: false
  notification:
    enabled: false
  openpitrix:
    enabled: false
  servicemesh:
    enabled: false
Copy the code

Environment initialization

./kk init os -f config-sample.yaml INFO[14:04:19 CST] Init operating system INFO[14:04:20 CST] Start initializing Kubesphere008 [10.26.31.121] node=10.26.31.121 INFO[14:04:20cst] Start initializing kubesphere001 [10.26.31.34] Node =10.26.31.34 INFO[14:04:20cst] Start initializing kubesphere003 [10.26.31.42] node=10.26.31.42 INFO[14:04:20cst] Start initializing kubesphere005 [10.26.31.118] node=10.26.31.118 INFO[14:04:20cst] Start initializing kubesphere006 [10.26.31.119] node=10.26.31.119 INFO[14:04:20cst] Start initializing kubesphere004 [10.26.31.46] node=10.26.31.46 INFO[14:04:20Cst] Start initializing kubesphere007 [10.26.31.120] node=10.26.31.120 INFO[14:04:20Cst] Start Initializing Kubesphere002 [10.26.31.36] node=10.26.31.36 INFO[14:06:34CST] Complete Initialization kubesphere005 [10.26.31.118] node=10.26.31.118 INFO[14:06:56CST] Complete Initialization kubesphere002 [10.26.31.36] node=10.26.31.36 INFO[14:07:04 CST] Complete Initialization kubesphere006 [10.26.31.119] node=10.26.31.119 INFO[14:07:04 CST] Complete Initialization Kubesphere007 [10.26.31.120] node=10.26.31.120 INFO[14:07:07CST] Complete Initialization Kubesphere003 [10.26.31.42] node=10.26.31.42 INFO[14:07:11CST] Complete Initialization kubesphere004 [10.26.31.46] node=10.26.31.46 INFO[14:08:23 CST] Complete initialization kubesphere001 [10.26.31.34] node=10.26.31.34 INFO[14:10:57CST] Complete Initialization Kubesphere008 [10.26.31.121] node=10.26.31.121 INFO[14:10:57CST] Init Operating system successful.Copy the code

After the above preparations are complete and the configuration files are checked again, start the installation.

./kk create cluster -f config-sample.yaml +-------------------------+------+------+---------+----------+-------+-------+-----------+--------+------------+-------- -----+------------------+--------------+ | name | sudo | curl | openssl | ebtables | socat | ipset | conntrack | docker | nfs client | ceph client | glusterfs client | time | +-------------------------+------+------+---------+----------+-------+-------+-----------+--------+------------+-------- -----+------------------+--------------+ | kubesphere005 | y | y | y | y | y | y | y | y | y | y | y | CST 14:16:55 | | kubesphere006 | y | y | y | y | y | y | y | y | y | y | y | CST 14:16:55 | | kubesphere007 | y | y | y | y | y | y | y |  y | y | y | y | CST 14:16:55 | | kubesphere004 | y | y | y | y | y | y | y | y | y | y | y | CST 14:16:55 | | kubesphere001 | y | y | y | y | y | y | y | y | y | y | y | CST 14:16:55 | | kubesphere003 | y | y | y | y | y | y | y |  y | y | y | y | CST 14:16:55 | | kubesphere002 | y | y | y | y | y | y | y | y | y | y | y | CST 14:16:55 | | kubesphere008 | y | y | y | y | y | y | y | y | y | y | y | CST 14:16:55 | +-------------------------+------+------+---------+----------+-------+-------+-----------+--------+------------+-------- -----+------------------+--------------+ This is a simple check of your environment. Before installation, you should ensure that your machines meet all requirements specified at https://github.com/kubesphere/kubekey#requirements-and-recommendations Continue this installation? [yes/no]: yes INFO[14:17:25 CST] Downloading Installation Files INFO[14:17:25 CST] Downloading kubeadm ... * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
### Welcome to KubeSphere! # # #
## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #Console: http://10.26.31.34:30880 Account: admin Password: P @ 88 w0rd NOTES:  1. After logging into the console, please check the monitoring status of service components in the "Cluster Management". If any service is not ready, please wait patiently until all components are ready. 2. Please modify the default password after login.
## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
https://kubesphere.io             2021-02-05 15:47:21
## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Copy the code

Kubesphere has been installed successfully and can be verified by visiting http://10.26.31.34:30880 in your browser

validation

You can log in to the KubeSphere console using the default account admin/P@88w0rd and start using KubeSphere. Change the default password after login.

The following figure shows the login

Now you can start your kubesphere journey. For more details, please refer to the official website