diff --git a/charts/README.md b/charts/README.md index 31c1862..b5e01fa 100644 --- a/charts/README.md +++ b/charts/README.md @@ -7,124 +7,20 @@ - Prerequisites - Kubernetes version is between 1.14 and 1.20. - The version of Prometheus Operator is v0.49.0. -- Apply for a cluster from [TKE](https://cloud.tencent.com/product/tke) or install [minikube](https://minikube.sigs.k8s.io/docs/start/). +- Apply for a cluster from [TKE](https://cloud.tencent.com/product/tke) or install [Minikube](https://minikube.sigs.k8s.io/docs/start/). + - Kstone supports deploy in various cloud vendors and bare k8s cluster environments + - In the environments mentioned above, only the corresponding ingress rules need to be configured. - Requirements: - - Worker >= 4 vCPU 8 GB of Memory. + - For production environment (recommended): Worker >= 4 vCPU 8 GB of Memory. + - For demo environment (minimum): Worker >= 2 vCPU 2 GB of Memory. - Can access the managed etcd. -## 2 Install minikube (optional) +## 2 Install on TKE -#### Step 1: +[Kstone installation on TKE](../docs/installation/tke.md) -- Install minikube (e.g. Linux amd64) - - Requirements:version <= 1.20.x -```shell -VERSION=v1.20.0 -curl -LO https://storage.googleapis.com/minikube/releases/${VERSION}/minikube-linux-amd64 -sudo install minikube-linux-amd64 /usr/local/bin/minikube -``` +## 3 Install on Minikube -#### Step 2: +[Kstone installation on Minikube(Mac OS X)](../docs/installation/minikube-macos.md) -- Alias `minikube kubectl` -```shell -alias kubectl="minikube kubectl --" -``` - -## 3 Deploy - -### 3.1 Modify Helm Configuration - -#### Step 1: - -- Download Helm Repo: - -``` shell -git clone git@github.com:tkestack/kstone.git -cd ./charts -``` - -- Modify Setting: - -``` yaml -// charts/values.yaml - -ingress: - enabled: true - className: "" - annotations: - nginx.ingress.kubernetes.io/rewrite-target: /$2 - service.cloud.tencent.com/direct-access: 'false' - kubernetes.io/ingress.class: qcloud - service.kubernetes.io/tke-existed-lbid: $lb - kubernetes.io/ingress.existLbId: $lb - kubernetes.io/ingress.subnetId: $subnet -``` - -Method 1: Use existing LB - -Refer to the above configuration and fill in the $lb and $subnet under the same VPC of the TKE cluster. - -Method 2: Do not use existing LB - -Delete the following configurations: - -- ingress.annotations.service.kubernetes.io/tke-existed-lbid -- kubernetes.io/ingress.existLbId -- kubernetes.io/ingress.subnetId - -#### Step 2: - -- Fill in the TOKEN of the cluster to deploy. - -``` yaml -// charts/charts/dashboard-api/values.yaml - -kube: - token: $token - target: kubernetes.default.svc.cluster.local:443 -``` - -- Requirements: - - $token is the access credential TOKEN of the TKE cluster to be deployed. - - $token needs to have access to all resources in the cluster. - -#### Step 3: Using the existing Prometheus Operator (optional) - -- Set `replica=0` in the file `charts/charts/kube-prometheus-stack/values.yaml`. -- Modify the file: `charts/charts/grafana/templates/configmap.yaml`, replace `http://{{ .Release.Name }}-prometheus-prometheus.{{ .Release.Namespace }}.svc.cluster.local:9090` to the query URL from the existing Prometheus Operator. - -### 3.2 Install - -``` shell -cd charts - -kubectl create ns kstone - -helm install kstone . -n kstone -``` - -### 3.3 Update - -``` shell -cd charts - -helm upgrade kstone . -n kstone -``` - -### 3.4 Uninstall - -``` shell -helm uninstall kstone -n kstone - -kubectl delete crd alertmanagerconfigs.monitoring.coreos.com -kubectl delete crd alertmanagers.monitoring.coreos.com -kubectl delete crd podmonitors.monitoring.coreos.com -kubectl delete crd probes.monitoring.coreos.com -kubectl delete crd prometheuses.monitoring.coreos.com -kubectl delete crd prometheusrules.monitoring.coreos.com -kubectl delete crd servicemonitors.monitoring.coreos.com -kubectl delete crd thanosrulers.monitoring.coreos.com -kubectl delete crd etcdclusters.kstone.tkestack.io -kubectl delete crd etcdinspections.kstone.tkestack.io -``` \ No newline at end of file +[Kstone installation on Minikube(Linux amd64)](../docs/installation/minikube-amd64.md) \ No newline at end of file diff --git a/charts/README_CN.md b/charts/README_CN.md index fdcb3fa..7e26c93 100644 --- a/charts/README_CN.md +++ b/charts/README_CN.md @@ -8,121 +8,19 @@ - Kubernetes集群版本在1.14和1.20之间。 - Prometheus-Operator版本为v0.49.0。 - 申请 [TKE](https://cloud.tencent.com/product/tke) 集群或搭建 [minikube](https://minikube.sigs.k8s.io/docs/start/) 集群。 + - Kstone 支持部署在多云或原生 K8s 集群中 + - 只需要安装并配置相对应的 Ingress 转发规则即可 - 环境要求: - - Worker 4C8G以上配置。 + - 生产环境配置要求(推荐):Worker 4C8G以上配置。 + - 体验环境配置要求(最低):Worker 2C2G以上配置。 - 可访问待管理的目标etcd。 -## 2 搭建 minikube 集群(可选) +## 2 在 TKE 集群安装 Kstone -#### 步骤一: -- 安装 minikube(以 Linux amd64 为例) - - 版本要求:低于 1.20.x -```shell -VERSION=v1.20.0 -curl -LO https://storage.googleapis.com/minikube/releases/${VERSION}/minikube-linux-amd64 -sudo install minikube-linux-amd64 /usr/local/bin/minikube -``` +[Kstone installation on TKE](../docs/installation/tke.md) -#### 步骤二: -- 为 `minikube kubectl` 命令设置别名 -```shell -alias kubectl="minikube kubectl --" -``` +## 3 在 Minikube 集群安装 Kstone -## 3 部署 +[Kstone installation on Minikube(Mac OS X)](../docs/installation/minikube-macos.md) -### 3.1 修改Helm配置 - -#### 步骤一: - -- 下载Helm Repo: - -``` shell -git clone git@github.com:tkestack/kstone.git -cd ./charts -``` - -- 修改配置: - -``` yaml -// charts/values.yaml - -ingress: - enabled: true - className: "" - annotations: - nginx.ingress.kubernetes.io/rewrite-target: /$2 - service.cloud.tencent.com/direct-access: 'false' - kubernetes.io/ingress.class: qcloud - service.kubernetes.io/tke-existed-lbid: $lb - kubernetes.io/ingress.existLbId: $lb - kubernetes.io/ingress.subnetId: $subnet -``` - -方式一 使用现有LB - -参考上述配置,填入TKE集群同VPC下的$lb和$subnet。 - -方式二 不使用现有LB - -删除以下配置: - -- ingress.annotations.service.kubernetes.io/tke-existed-lbid -- kubernetes.io/ingress.existLbId -- kubernetes.io/ingress.subnetId - -#### 步骤二: - -- 填入运行集群的TOKEN。 - -``` yaml -// charts/charts/dashboard-api/values.yaml - -kube: - token: $token - target: kubernetes.default.svc.cluster.local:443 -``` - -- 要求: - - $token为即将部署的TKE集群的访问凭证TOKEN。 - - $token需要具备访问集群范围所有资源的权限。 - -#### 第三步:使用已部署的Prometheus Operator(可选) - -- 将文件`charts/charts/kube-prometheus-stack/values.yaml`中的副本数`replica`配置为0。 -- 使用已部署的Prometheus Operator提供的查询URL替换文件`charts/charts/grafana/templates/configmap.yaml`中的`http://{{ .Release.Name }}-prometheus-prometheus.{{ .Release.Namespace }}.svc.cluster.local:9090` - -### 3.2 安装 - -``` shell -cd charts - -kubectl create ns kstone - -helm install kstone . -n kstone -``` - -### 3.3 更新 - -``` shell -cd charts - -helm upgrade kstone . -n kstone -``` - -### 3.4 卸载 - -``` shell -helm uninstall kstone -n kstone - -kubectl delete crd alertmanagerconfigs.monitoring.coreos.com -kubectl delete crd alertmanagers.monitoring.coreos.com -kubectl delete crd podmonitors.monitoring.coreos.com -kubectl delete crd probes.monitoring.coreos.com -kubectl delete crd prometheuses.monitoring.coreos.com -kubectl delete crd prometheusrules.monitoring.coreos.com -kubectl delete crd servicemonitors.monitoring.coreos.com -kubectl delete crd thanosrulers.monitoring.coreos.com -kubectl delete crd etcdclusters.kstone.tkestack.io -kubectl delete crd etcdinspections.kstone.tkestack.io -``` \ No newline at end of file +[Kstone installation on Minikube(Linux amd64)](../docs/installation/minikube-amd64.md) \ No newline at end of file diff --git a/docs/images/kstone-etcd-cluster-create.png b/docs/images/kstone-etcd-cluster-create.png new file mode 100644 index 0000000..35ed0c4 Binary files /dev/null and b/docs/images/kstone-etcd-cluster-create.png differ diff --git a/docs/images/kstone-etcd-cluster-running.png b/docs/images/kstone-etcd-cluster-running.png new file mode 100644 index 0000000..7f108a6 Binary files /dev/null and b/docs/images/kstone-etcd-cluster-running.png differ diff --git a/docs/images/kstone-overview.png b/docs/images/kstone-overview.png new file mode 100644 index 0000000..45475a3 Binary files /dev/null and b/docs/images/kstone-overview.png differ diff --git a/docs/installation/minikube-amd64.md b/docs/installation/minikube-amd64.md new file mode 100644 index 0000000..d1ffdb2 --- /dev/null +++ b/docs/installation/minikube-amd64.md @@ -0,0 +1,192 @@ +# Kstone Installation + +[中文](README_CN.md) + +## 1 Preparation + +- Prerequisites + - Kubernetes version is between 1.14 and 1.20. + - The version of Prometheus Operator is v0.49.0. +- Requirements: + - Worker >= 2 vCPU 2 GB of Memory. + - Can access the managed etcd. + +## 2 Install Minikube + +#### Step 1: + +- Switch to non-root User +```shell +adduser kstone +# set password for kstone user +passwd kstone + +su - kstone + +sudo groupadd docker + +sudo usermod -aG docker $USER + +# Re-Login and Restart the Docker Server +systemctl restart docker +``` + +#### Step 2: +- [Install Minikube](https://minikube.sigs.k8s.io/docs/start/) (e.g. Linux amd64) + - Requirements:version <= 1.20.x +```shell +VERSION=v1.20.0 +curl -LO https://github.com/kubernetes/minikube/releases/download/${VERSION}/minikube-linux-amd64 +sudo install minikube-linux-amd64 /usr/local/bin/minikube +minikube start --driver=docker +``` + + + +- Alias `minikube kubectl` +```shell +alias kubectl="minikube kubectl --" +``` +#### Step 3: + +- Deploy ingress controller +```shell +minikube addons enable ingress +``` + +## 3 Deploy + +### 3.1 Modify Helm Configuration + +#### Step 1: +- Install helm: + +Please refer to [helm installation](https://helm.sh/docs/intro/install/) + +- Download Helm Repo: + +``` shell +git clone git@github.com:tkestack/kstone.git +cd ./charts +``` + +#### Step 2: + +- Get Admin TOKEN from Minikube cluster + +```shell +kubectget secrets -o jsonpath="{.items[?(@.metadata.annotations['kubernetes\.io/service-account\.name']=='default')].data.token}" -n kube-system|base64 --decode +``` + +- Fill in the TOKEN of the cluster to deploy. + +``` yaml +// charts/charts/dashboard-api/values.yaml + +kube: + token: $token + target: kubernetes.default.svc.cluster.local:443 +``` + +- Requirements: + - $token is the access credential TOKEN of the cluster to be deployed. + - $token needs to have access to all resources in the cluster. + +#### Step 3: Using the existing Prometheus Operator (optional) + +- Set `replica=0` in the file `charts/charts/kube-prometheus-stack/values.yaml`. +- Modify the file: `charts/charts/grafana/templates/configmap.yaml`, replace `http://{{ .Release.Name }}-prometheus-prometheus.{{ .Release.Namespace }}.svc.cluster.local:9090` to the query URL from the existing Prometheus Operator. + +### 3.2 Install + +- Install Kstone + +``` shell +cd charts + +kubectl create ns kstone + +helm install kstone . -n kstone +``` +- Create Ingress Rule + +```shell +cat <:8080` in the browser + +![Kstone Overview](../images/kstone-overview.png) + +- Create an ETCD cluster + +![Kstone Overview](../images/kstone-etcd-cluster-create.png) + +- Cluster is Running + +![Kstone Cluster Running](../images/kstone-etcd-cluster-running.png) + +### 3.3 Update + +``` shell +cd charts + +helm upgrade kstone . -n kstone +``` + +### 3.4 Uninstall + +``` shell +helm uninstall kstone -n kstone + +kubectl delete crd alertmanagerconfigs.monitoring.coreos.com +kubectl delete crd alertmanagers.monitoring.coreos.com +kubectl delete crd podmonitors.monitoring.coreos.com +kubectl delete crd probes.monitoring.coreos.com +kubectl delete crd prometheuses.monitoring.coreos.com +kubectl delete crd prometheusrules.monitoring.coreos.com +kubectl delete crd servicemonitors.monitoring.coreos.com +kubectl delete crd thanosrulers.monitoring.coreos.com +kubectl delete crd etcdclusters.kstone.tkestack.io +kubectl delete crd etcdinspections.kstone.tkestack.io +``` +- Uninstall Minikube +```shell +minikube stop && minikube delete +``` \ No newline at end of file diff --git a/docs/installation/minikube-macos.md b/docs/installation/minikube-macos.md new file mode 100644 index 0000000..509a442 --- /dev/null +++ b/docs/installation/minikube-macos.md @@ -0,0 +1,187 @@ +# Kstone Installation + +[中文](README_CN.md) + +## 1 Preparation + +- Prerequisites + - Kubernetes version is between 1.14 and 1.20. + - The version of Prometheus Operator is v0.49.0. +- Requirements: + - Worker >= 2 vCPU 2 GB of Memory. + - Can access the managed etcd. + +## 2 Install Minikube + +#### Step 1: + +- [Install VirtualBox](https://www.virtualbox.org/wiki/Downloads) + +- [Configure Virtual Box Network](https://www.virtualbox.org/manual/ch06.html#network_hostonly) (Allow 10.0.0.0/8 and 192.168.0.0/16 IPv4 ranges) +```shell +sudo mkdir -p /etc/vbox && sudo bash -c "cat > /etc/vbox/networks.conf" << EOF + * 10.0.0.0/8 192.168.0.0/16 + * 2001::/64 +EOF +``` + +#### Step 2: +- [Install Minikube](https://minikube.sigs.k8s.io/docs/start/) (e.g. Mac OSX) + - Requirements:version <= 1.20.x +```shell +VERSION=v1.20.0 +curl -LO https://github.com/kubernetes/minikube/releases/download/${VERSION}/minikube-darwin-amd64 +sudo install minikube-darwin-amd64 /usr/local/bin/minikube +minikube start --vm-driver=virtualbox +``` + +#### Step 3: + +- Alias `minikube kubectl` +```shell +alias kubectl="minikube kubectl --" +``` +#### Step 4: + +- Deploy ingress controller +```shell +minikube addons enable ingress +``` + +## 3 Deploy + +### 3.1 Modify Helm Configuration + +#### Step 1: +- Install helm: + +Please refer to [helm installation](https://helm.sh/docs/intro/install/) + +- Download Helm Repo: + +``` shell +git clone git@github.com:tkestack/kstone.git +cd ./charts +``` + +#### Step 2: + +- Get Admin TOKEN from Minikube cluster + +```shell +kubectget secrets -o jsonpath="{.items[?(@.metadata.annotations['kubernetes\.io/service-account\.name']=='default')].data.token}" -n kube-system|base64 --decode +``` + +- Fill in the TOKEN of the cluster to deploy. + +``` yaml +// charts/charts/dashboard-api/values.yaml + +kube: + token: $token + target: kubernetes.default.svc.cluster.local:443 +``` + +- Requirements: + - $token is the access credential TOKEN of the cluster to be deployed. + - $token needs to have access to all resources in the cluster. + +#### Step 3: Using the existing Prometheus Operator (optional) + +- Set `replica=0` in the file `charts/charts/kube-prometheus-stack/values.yaml`. +- Modify the file: `charts/charts/grafana/templates/configmap.yaml`, replace `http://{{ .Release.Name }}-prometheus-prometheus.{{ .Release.Namespace }}.svc.cluster.local:9090` to the query URL from the existing Prometheus Operator. + +### 3.2 Install + +- Install Kstone + +``` shell +cd charts + +kubectl create ns kstone + +helm install kstone . -n kstone +``` +- Create Ingress Rule + +```shell +cat <= 4 vCPU 8 GB of Memory. + - Can access the managed etcd. + +## 2 Deploy + +### 2.1 Modify Helm Configuration + +#### Step 1: +- Install helm: + +Please refer to [helm installation](https://helm.sh/docs/intro/install/) + +- Download Helm Repo: + +``` shell +git clone git@github.com:tkestack/kstone.git +cd ./charts +``` + +- Modify Setting: + +``` yaml +// charts/values.yaml + +ingress: + enabled: true + className: "" + annotations: + nginx.ingress.kubernetes.io/rewrite-target: /$2 + service.cloud.tencent.com/direct-access: 'false' + kubernetes.io/ingress.class: qcloud + service.kubernetes.io/tke-existed-lbid: $lb + kubernetes.io/ingress.existLbId: $lb + kubernetes.io/ingress.subnetId: $subnet +``` + +Method 1: Use existing LB + +Refer to the above configuration and fill in the $lb and $subnet under the same VPC of the TKE cluster. + +Method 2: Do not use existing LB + +Delete the following configurations: + +- ingress.annotations.service.kubernetes.io/tke-existed-lbid +- kubernetes.io/ingress.existLbId +- kubernetes.io/ingress.subnetId + +#### Step 2: + +- Get Admin TOKEN from TKE cluster + +```shell +kubectl get secrets -o jsonpath="{.items[?(@.metadata.annotations['kubernetes\.io/service-account\.name']=='kube-admin')].data.token}" -n kube-system|base64 --decode +``` +- Fill in the TOKEN of the cluster to deploy. + +``` yaml +// charts/charts/dashboard-api/values.yaml + +kube: + token: $token + target: kubernetes.default.svc.cluster.local:443 +``` + +- Requirements: + - $token is the access credential TOKEN of the TKE cluster to be deployed. + - $token needs to have access to all resources in the cluster. + +#### Step 3: Using the existing Prometheus Operator (optional) + +- Set `replica=0` in the file `charts/charts/kube-prometheus-stack/values.yaml`. +- Modify the file: `charts/charts/grafana/templates/configmap.yaml`, replace `http://{{ .Release.Name }}-prometheus-prometheus.{{ .Release.Namespace }}.svc.cluster.local:9090` to the query URL from the existing Prometheus Operator. + +### 2.2 Install + +- Helm is +``` shell +cd charts + +kubectl create ns kstone + +helm install kstone . -n kstone +``` + +### 2.3 Update + +``` shell +cd charts + +helm upgrade kstone . -n kstone +``` + +### 2.4 Uninstall + +``` shell +helm uninstall kstone -n kstone + +kubectl delete crd alertmanagerconfigs.monitoring.coreos.com +kubectl delete crd alertmanagers.monitoring.coreos.com +kubectl delete crd podmonitors.monitoring.coreos.com +kubectl delete crd probes.monitoring.coreos.com +kubectl delete crd prometheuses.monitoring.coreos.com +kubectl delete crd prometheusrules.monitoring.coreos.com +kubectl delete crd servicemonitors.monitoring.coreos.com +kubectl delete crd thanosrulers.monitoring.coreos.com +kubectl delete crd etcdclusters.kstone.tkestack.io +kubectl delete crd etcdinspections.kstone.tkestack.io +``` \ No newline at end of file