In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to install KubeSphere". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to install KubeSphere.
1. Environmental preparation
Of course, some students may have obsessive-compulsive disorder like me. Even if I don't have a ready-made Kubernetes environment, I don't want KubeSphere to give me a family bucket. I still want to build my own K8s cluster. What to do? binary deployment is so annoying. Is there a simple and quick way to build a cluster in ten minutes? Of course, just use sealos. You only need one command to install all dependencies across hosts. You don't need ansible or ssh to log in to other machines. You need to do some preparatory work before installation:
All nodes install and start docker
Download the kubernetes offline installation package
Download the latest version of sealos (currently stable version is 2.0.4)
My machine plan goes like this:
HostnameIPRolesealos-node1192.168.0.2mastersealos-node2192.168.0.3nodesealos-node3192.168.0.4node
The installation steps are divided into the following steps:
1. Execute the following command on master:
Sealos init-- master 192.168.0.2\-- node 192.168.0.3\-- node 192.168.0.4\-- user root\-- passwd password\-- version v1.14.5\-- pkg-url / root/kube1.14.5.tar.gz
2. It's gone.
No, no, if you want to know how it works, please check the official documentation of sealos.
Next, we will officially enter the installation process of KubeSphere.
two。 Install KubeSphere
1. First, clone the ks-installer repository to the master node:
$git clone https://github.com/kubesphere/ks-installer-b advanced-2.0.2
2. Create namespace named kubesphere-system and kubesphere-monitoring-system in the Kubernetes cluster.
3. Create the Secret of the Kubernetes cluster CA certificate.
> Note: create according to the current cluster ca.crt and ca.key certificate path (the certificate path for Kubeadm to create a cluster is usually / etc/kubernetes/pki)
$kubectl-n kubesphere-system create secret generic kubesphere-ca\-- from-file=ca.crt=/etc/kubernetes/pki/ca.crt\-- from-file=ca.key=/etc/kubernetes/pki/ca.key
4. Create the certificate Secret of etcd.
> Note: created according to the actual etcd certificate location of the cluster
If etcd has already configured a certificate, please refer to the creation below:
$kubectl-n kubesphere-monitoring-system create secret generic kube-etcd-client-certs\-from-file=etcd-client-ca.crt=/etc/kubernetes/pki/etcd/ca.crt\-from-file=etcd-client.crt=/etc/kubernetes/pki/etcd/healthcheck-client.crt\-from-file=etcd-client.key=/etc/kubernetes/pki/etcd/healthcheck-client.key
If etcd does not have a certificate configured, create an empty Secret (the following command applies to the Kubernetes cluster environment created by Kubeadm):
$kubectl-n kubesphere-monitoring-system create secret generic kube-etcd-client-certs
Here is a cluster built with sealos. You can obtain its certificate by looking at the resource manifest file of etcd:
5. Modify the deployment file
Because there are so many components involved in the KubeSphere deployment process, and there are many inexplicable holes in the installation process, you may encounter the following problems:
* * question 1. If metrics-server is already installed in the existing cluster, you need to set metrics_server_enable to False in the configuration file. I don't have this component installed in my cluster, so I don't need to set it to False.
* * problem 2sonarqube is stuck in Waitting for ks-sonarqube port to become open during installation, and sonarqube can be accessed normally on the node through NodePort. This problem has not been solved. Since it is an operation that does not affect the global installation, sonarqube_enable is also set to False in the configuration file.
* * question 3: if the current cluster resources are not sufficient, you can temporarily cancel the installation of istio, and then enable istio support later.
* * the components of the problem 4:**KubeSphere use persistent storage by default. You need to ensure that there is a default StorageClass resource object in the cluster. If you just want to deploy a demo temporarily, you can set the enable in the persistence to false in the configuration file.
The configuration file I finally used to install KubeSphere is as follows:
You only need to modify the value of ConfigMap, where kube_apiserver_host is the APIServer address of the existing cluster, and etcd_endpoint_ips is the node IP of etcd. The default port is 2379. If you are in cluster mode etcd, you can enter multiple node IP here, separated by intermediate use. Here are the components that do not need to be installed and set to False.
6. Customize the Docker image.
Since logging cannot be disabled in ConfigMap at present, ansible playbook can only be forcibly modified. Go to the root directory of ks-installer and delete the ks-logging in kubesphere.yaml:
Then modify Dockerfile to replace Helm v2 with Helm v3, because, you know, I don't want to install tiller. The modified Dockerfile is as follows:
Finally, rebuild the image, change the image of Deployment in the deployment file to a custom image, and then you can deploy directly:
$kubectl apply-f deploy/kubesphere.yaml$ kubectl-n kubesphere-system get podNAME READY STATUS RESTARTS AGEks-account-585846bd44-mt7ss 1 to 1 Running 0 3h9mks-apigateway-7d77cb9495-hxgz8 1 to 1 Running 0 3h9mks-apiserver-697c5f4859-dsbmm 1 to 1 Running 0 3h7mks -console-5b8fbf45c4- 7hxrw 1 to 1 Running 0 3h8mks-console-5b8fbf45c4-hj4bj 1 to 1 Running 0 3h8mks-controller-manager-7497f6c944-4k8wd 1 to 1 Running 0 3h8mks-docs-65999c97c9-5f9z7 1 to 1 Running 0 3h47mkubesphere-installer-6j49s 0 to 1 Completed 0 3h20mopenldap-78df9f7b47-wvs5n 1 Running 0 3h48mredis-99f5985b8-2d62q 1 Running 0 3h 48m $kubectl-n kubesphere-system get jobNAME COMPLETIONS DURATION AGEkubesphere-installer 1 2m9s 3h20m
If the Job used for installation above is completed, it proves that KubeSphere has been installed successfully.
You can create an IngressRoute object to access KubeSphere:
Add the domain name information to your local computer's hosts and you can access KubeSphere's Dashboard in your browser.
The default cluster administrator account is:
User name: admin
Password: P@88w0rd
Thank you for your reading, the above is the content of "how to install KubeSphere", after the study of this article, I believe you have a deeper understanding of how to install KubeSphere, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.