Skip to content

Commit

Permalink
Merge pull request #569 from qmhu/quick-start
Browse files Browse the repository at this point in the history
Add docs for quick-start
  • Loading branch information
mfanjie authored Sep 27, 2022
2 parents a186a65 + c877906 commit a90e9ce
Show file tree
Hide file tree
Showing 7 changed files with 267 additions and 177 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Crane Agent is a `DaemonSet` that runs in each node.
## Getting Started

- [Introduction](https://gocrane.io/docs/getting-started/introduction/)
- [Installation](https://gocrane.io/docs/getting-started/installation/)
- [Quick Start](https://gocrane.io/docs/getting-started/quick-start/)
- [Tutorials](https://gocrane.io/docs/tutorials/)

## Documentation
Expand Down
2 changes: 1 addition & 1 deletion README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Crane Agent 通过 `DaemonSet` 部署在集群的节点上。
## 快速开始

- [介绍](https://gocrane.io/zh-cn/docs/getting-started/introduction/)
- [安装](https://gocrane.io/zh-cn/docs/getting-started/installation/)
- [快速开始](https://gocrane.io/zh-cn/docs/getting-started/quick-start/)
- [教程](https://gocrane.io/zh-cn/docs/tutorials/)

## 文档
Expand Down
8 changes: 6 additions & 2 deletions hack/local-env-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CRANE_CLUSTER_NAME="crane"

echo "Step1: Create local cluster: " ${CRANE_KUBECONFIG}
kind delete cluster --name="${CRANE_CLUSTER_NAME}" 2>&1
kind create cluster --kubeconfig "${CRANE_KUBECONFIG}" --name "${CRANE_CLUSTER_NAME}"
kind create cluster --kubeconfig "${CRANE_KUBECONFIG}" --name "${CRANE_CLUSTER_NAME}" --image kindest/node:v1.21.1
export KUBECONFIG="${CRANE_KUBECONFIG}"
echo "Step1: Create local cluster finished."

Expand Down Expand Up @@ -39,4 +39,8 @@ helm install fadvisor -n crane-system --create-namespace crane/fadvisor
echo "Step4: Installing Crane finished."

kubectl get deploy -n crane-system
echo "Please wait for all pods ready"
echo "Please wait for all pods ready"
echo "After all pods ready, Get the Crane Dashboard URL to visit by running these commands in the same shell:"
echo " export KUBECONFIG=${HOME}/.kube/config_crane"
echo " kubectl -n crane-system port-forward service/craned 9090:9090"

164 changes: 76 additions & 88 deletions site/content/en/docs/Getting started/installation.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Installation"
description: "How to install Crane"
weight: 11
weight: 12
---

## Prerequisites
Expand All @@ -17,82 +17,73 @@ Please refer to Helm's [documentation](https://helm.sh/docs/intro/install/) for

### Installing prometheus and grafana with helm chart

!!! note
If you already deployed prometheus, grafana in your environment, then skip this step.
{{% alert color="warning" %}}
If you already deployed prometheus, grafana in your environment, then skip this step.
{{% /alert %}}

!!! Warning "Network Problems"
If your network is hard to connect GitHub resources, you can try the mirror repo. Like GitHub Release, GitHub Raw Content `raw.githubusercontent.com`.

But mirror repo has a certain **latency**.[Mirror Repo](mirror.md)
{{% alert color="warning" %}}
If your network is hard to connect GitHub resources, you can try the mirror repo. Like GitHub Release, GitHub Raw Content raw.githubusercontent.com.
But mirror repo has a certain latency. Please see Mirror Resources to know details.
{{% /alert %}}

Crane use prometheus to be the default metric provider.

Using following command to install prometheus components: prometheus-server, node-exporter, kube-state-metrics.

=== "Main"

```bash
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm install prometheus -n crane-system \
--set pushgateway.enabled=false \
--set alertmanager.enabled=false \
--set server.persistentVolume.enabled=false \
-f https://raw.githubusercontent.com/gocrane/helm-charts/main/integration/prometheus/override_values.yaml \
--create-namespace prometheus-community/prometheus
```

=== "Mirror"

```bash
helm repo add prometheus-community https://finops-helm.pkg.coding.net/gocrane/prometheus-community
helm install prometheus -n crane-system \
--set pushgateway.enabled=false \
--set alertmanager.enabled=false \
--set server.persistentVolume.enabled=false \
-f https://gitee.com/finops/helm-charts/raw/main/integration/prometheus/override_values.yaml \
--create-namespace prometheus-community/prometheus
```
Fadvisor use grafana to present cost estimates. Using following command to install a grafana.


=== "Main"
{{< tabpane right=true >}}
{{< tab header="Main" lang="en" >}}
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm install prometheus -n crane-system \
--set pushgateway.enabled=false \
--set alertmanager.enabled=false \
--set server.persistentVolume.enabled=false \
-f https://raw.githubusercontent.com/gocrane/helm-charts/main/integration/prometheus/override_values.yaml \
--create-namespace prometheus-community/prometheus
{{< /tab >}}
{{< tab header="Mirror" lang="en" >}}
helm repo add prometheus-community https://finops-helm.pkg.coding.net/gocrane/prometheus-community
helm install prometheus -n crane-system \
--set pushgateway.enabled=false \
--set alertmanager.enabled=false \
--set server.persistentVolume.enabled=false \
-f https://gitee.com/finops/helm-charts/raw/main/integration/prometheus/override_values.yaml \
--create-namespace prometheus-community/prometheus
{{< /tab >}}
{{% /tabpane %}}

```bash
helm repo add grafana https://grafana.github.io/helm-charts
helm install grafana \
-f https://raw.githubusercontent.com/gocrane/helm-charts/main/integration/grafana/override_values.yaml \
-n crane-system \
--create-namespace grafana/grafana
```

=== "Mirror"
Fadvisor use grafana to present cost estimates. Using following command to install a grafana.

```bash
helm repo add grafana https://finops-helm.pkg.coding.net/gocrane/grafana
helm install grafana \
-f https://gitee.com/finops/helm-charts/raw/main/integration/grafana/override_values.yaml \
-n crane-system \
--create-namespace grafana/grafana
```
{{< tabpane right=true >}}
{{< tab header="Main" lang="en" >}}
helm repo add grafana https://grafana.github.io/helm-charts
helm install grafana \
-f https://raw.githubusercontent.com/gocrane/helm-charts/main/integration/grafana/override_values.yaml \
-n crane-system \
--create-namespace grafana/grafana
{{< /tab >}}
{{< tab header="Mirror" lang="en" >}}
helm repo add grafana https://finops-helm.pkg.coding.net/gocrane/grafana
helm install grafana \
-f https://gitee.com/finops/helm-charts/raw/main/integration/grafana/override_values.yaml \
-n crane-system \
--create-namespace grafana/grafana
{{< /tab >}}
{{% /tabpane %}}

### Deploying Crane and Fadvisor


=== "Main"

```bash
helm repo add crane https://gocrane.github.io/helm-charts
helm install crane -n crane-system --create-namespace crane/crane
helm install fadvisor -n crane-system --create-namespace crane/fadvisor
```

=== "Mirror"

```bash
helm repo add crane https://finops-helm.pkg.coding.net/gocrane/gocrane
helm install crane -n crane-system --create-namespace crane/crane
helm install fadvisor -n crane-system --create-namespace crane/fadvisor
```
{{< tabpane right=true >}}
{{< tab header="Main" lang="en" >}}
helm repo add crane https://gocrane.github.io/helm-charts
helm install crane -n crane-system --create-namespace crane/crane
helm install fadvisor -n crane-system --create-namespace crane/fadvisor
{{< /tab >}}
{{< tab header="Mirror" lang="en" >}}
helm repo add crane https://finops-helm.pkg.coding.net/gocrane/gocrane
helm install crane -n crane-system --create-namespace crane/crane
helm install fadvisor -n crane-system --create-namespace crane/fadvisor
{{< /tab >}}
{{% /tabpane %}}

### Deploying Crane-scheduler(optional)
```bash
Expand Down Expand Up @@ -129,27 +120,24 @@ you can see [this](https://github.com/gocrane/helm-charts) to learn more.

Deploy `Crane` by apply YAML declaration.

=== "Main"

```bash
git clone https://github.com/gocrane/crane.git
CRANE_LATEST_VERSION=$(curl -s https://api.github.com/repos/gocrane/crane/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')
git checkout $CRANE_LATEST_VERSION
kubectl apply -f deploy/manifests
kubectl apply -f deploy/craned
kubectl apply -f deploy/metric-adapter
```

=== "Mirror"

```bash
git clone https://e.coding.net/finops/gocrane/crane.git
CRANE_LATEST_VERSION=$(curl -s https://api.github.com/repos/gocrane/crane/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')
git checkout $CRANE_LATEST_VERSION
kubectl apply -f deploy/manifests
kubectl apply -f deploy/craned
kubectl apply -f deploy/metric-adapter
```
{{< tabpane right=true >}}
{{< tab header="Main" lang="en" >}}
git clone https://github.com/gocrane/crane.git
CRANE_LATEST_VERSION=$(curl -s https://api.github.com/repos/gocrane/crane/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')
git checkout $CRANE_LATEST_VERSION
kubectl apply -f deploy/manifests
kubectl apply -f deploy/craned
kubectl apply -f deploy/metric-adapter
{{< /tab >}}
{{< tab header="Mirror" lang="en" >}}
git clone https://e.coding.net/finops/gocrane/crane.git
CRANE_LATEST_VERSION=$(curl -s https://api.github.com/repos/gocrane/crane/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')
git checkout $CRANE_LATEST_VERSION
kubectl apply -f deploy/manifests
kubectl apply -f deploy/craned
kubectl apply -f deploy/metric-adapter
{{< /tab >}}
{{% /tabpane %}}

The following command will configure prometheus http address for crane if you want to customize it. Specify `CUSTOMIZE_PROMETHEUS` if you have existing prometheus server.

Expand All @@ -162,7 +150,7 @@ if [ $CUSTOMIZE_PROMETHEUS ]; then sed -i '' "s/http:\/\/prometheus-server.crane

You can use the dashboard to view and manage crane manifests.

![](images/dashboard.png)
![](/images/dashboard.png)

### Port Forward

Expand Down
56 changes: 56 additions & 0 deletions site/content/en/docs/Getting started/quick-start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
title: "Quick Start"
description: "Quick Start guide for Crane"
weight: 11
---

Welcome to Crane! In this document, we will work through how to install Crane and visit Crane Dashboard in your local
environments:

- Create a local running Kubernetes cluster by [Kind](https://kind.sigs.k8s.io/)
- Install Prometheus and Grafana by [Helm](https://helm.sh/)
- Install Crane by [Helm](https://helm.sh/)
- Visit Crane Dashboard via kubectl port-forward

Please referring to [Installation](/docs/getting-started/installation) to know more about how to install crane 。

## Prerequisites

- kubectl
- Kubernetes 1.18+
- Helm 3.1.0
- Kind 0.16+

## Installation

Following command will install Crane with dependencies applications(Prometheus/Grafana).

```bash
curl -sf https://raw.githubusercontent.com/gocrane/crane/main/hack/local-env-setup.sh | sh -
```

Make sure all pods are running:

```bash
$ export KUBECONFIG=${HOME}/.kube/config_crane
$ kubectl get deploy -n crane-system
NAME READY STATUS RESTARTS AGE
crane-agent-5r9l2 1/1 Running 0 4m40s
craned-6dcc5c569f-vnfsf 2/2 Running 0 4m41s
fadvisor-5b685f4cd6-xpxzq 1/1 Running 0 4m37s
grafana-64656f6d54-6l24j 1/1 Running 0 4m46s
metric-adapter-967c6d57f-swhfv 1/1 Running 0 4m41s
prometheus-kube-state-metrics-7f9d78cffc-p8l7c 1/1 Running 0 4m46s
prometheus-node-exporter-4wk8b 1/1 Running 0 4m40s
prometheus-server-fb944f4b7-4qqlv 2/2 Running 0 4m46s
```

## Visit Crane Dashboard

```bash
kubectl -n crane-system port-forward service/craned 9090:9090
```

Visit dashboard via [here](http://127.0.0.1:9090/)

![](/images/dashboard.png)
Loading

0 comments on commit a90e9ce

Please sign in to comment.