Skip to content

Commit

Permalink
Added example of installing kurator on killercuda
Browse files Browse the repository at this point in the history
Signed-off-by: LiZhenCheng9527 <[email protected]>
  • Loading branch information
LiZhenCheng9527 committed Jun 14, 2024
1 parent a477982 commit 6f66bfb
Show file tree
Hide file tree
Showing 11 changed files with 205 additions and 0 deletions.
3 changes: 3 additions & 0 deletions install-kurator/finish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Summary

In this scenario, we learned how to initialize the Kurator control plane and join a cluster.
95 changes: 95 additions & 0 deletions install-kurator/foreground.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail

# variable define
kind_version=v0.17.0
host_cluster_ip=172.30.1.2 #host node where Kurator is located
member_cluster_ip=172.30.2.2
local_ip=127.0.0.1
KUBECONFIG_PATH=${KUBECONFIG_PATH:-"${HOME}/.kube"}

function installKind() {
cat << EOF > installKind.sh
wget https://github.com/kubernetes-sigs/kind/releases/download/${kind_version}/kind-linux-amd64
chmod +x kind-linux-amd64
sudo mv kind-linux-amd64 /usr/local/bin/kind
EOF
}

function createCluster() {
cat << EOF > createCluster.sh
kind create cluster --name=member1 --config=cluster1.yaml
mv $HOME/.kube/config ~/config-member1
kind create cluster --name=member2 --config=cluster2.yaml
mv $HOME/.kube/config config-member2
KUBECONFIG=~/config-member1:~/config-member2 kubectl config view --merge --flatten >> ${KUBECONFIG_PATH}/config
# modify ip
sed -i "s/${local_ip}/${member_cluster_ip}/g" config-member1
scp config-member1 root@${host_cluster_ip}:$HOME/.kube/config-member1
sed -i "s/${local_ip}/${member_cluster_ip}/g" config-member2
scp config-member2 root@${host_cluster_ip}:$HOME/.kube/config-member2
EOF
}

function cluster1Config() {
touch cluster1.yaml
cat << EOF > cluster1.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
apiServerAddress: "${member_cluster_ip}"
apiServerPort: 6443
EOF
}

function cluster2Config() {
touch cluster2.yaml
cat << EOF > cluster2.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
apiServerAddress: "${member_cluster_ip}"
apiServerPort: 6444
EOF
}

function copyConfigFilesToNode() {
scp installKind.sh root@${member_cluster_ip}:~
scp createCluster.sh root@${member_cluster_ip}:~
scp cluster1.yaml root@${member_cluster_ip}:~
scp cluster2.yaml root@${member_cluster_ip}:~
}

function fluxcd_values() {
touch fluxcd.yaml
cat << EOF > fluxcd.yaml
imageAutomationController:
create: false
imageReflectionController:
create: false
notificationController:
create: false
EOF
}

kubectl delete node node01
kubectl taint node controlplane node-role.kubernetes.io/control-plane:NoSchedule-

# install kind and create member clusters
installKind
createCluster
cluster1Config
cluster2Config
fluxcd_values
copyConfigFilesToNode

# create cluster in node01 machine
ssh root@${member_cluster_ip} "bash ~/installKind.sh" &
sleep 10
ssh root@${member_cluster_ip} "bash ~/createCluster.sh"

# clean screen
clear
Binary file added install-kurator/image/success.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions install-kurator/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"title": "install Kurator",
"description": "Installing Kurator on Kubernetes",
"details": {
"intro": {
"text": "intro.md",
"foreground": "foreground.sh"
},
"steps": [
{
"title": "Check member cluster",
"text": "step1/text.md",
"verify": "step1/verify.sh"
},
{
"title": "Environment preparation",
"text": "step2/text.md",
"verify": "step2/verify.sh"
},
{
"title": "install Kurator",
"text": "step3/text.md",
"verify": "step3/verify.sh"
}
],
"finish": {
"text": "finish.md"
}
},
"backend": {
"imageid": "kubernetes-kubeadm-2nodes"
}
}
11 changes: 11 additions & 0 deletions install-kurator/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# What is Kurator?

Kurator is an open source distributed cloud native platform that helps users to build their own distributed cloud native infrastructure and facilitates enterprise digital transformation.

Kurator stands on shoulders of many popular cloud native software stacks including Kubernetes, Istio, Prometheus, FluxCD, KubeEdge, Volcano, Karmada, Kyverno, etc. It provides powerful capabilities for multi-cloud and multi-cluster management, including:

- Multi-cloud, Edge-cloud, Edge-edge Synergy
- Unified Resource Orchestration
- Unified Scheduling
- Unified Traffic Management
- Unified Telemetry
16 changes: 16 additions & 0 deletions install-kurator/step1/text.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### Background:

- The kubeconfig files for the host cluster, member1 cluster, and member2 cluster are located in the $HOME/.kube directory. These files are named config, config-member1, and config-member2 respectively.

```shell
$HOME/.kube/config
$HOME/.kube/config-member1
$HOME/.kube/config-member2
```

- Check whether the member cluster is ready

RUN `kubectl --kubeconfig=$HOME/.kube/config-member1 config get-contexts`{{exec}}

RUN `kubectl --kubeconfig=$HOME/.kube/config-member2 config get-contexts`{{exec}}

3 changes: 3 additions & 0 deletions install-kurator/step1/verify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

kubectl --kubeconfig=$HOME/.kube/config config get-contexts
19 changes: 19 additions & 0 deletions install-kurator/step2/text.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Preparation

### Install Helm

RUN `curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 && chmod 700 get_helm.sh && ./get_helm.sh`{{exec}}

### Preparing the environment

RUN `helm repo add jetstack https://charts.jetstack.io && helm repo update`{{exec}}

RUN `kubectl create namespace cert-manager`{{exec}}

RUN `helm install -n cert-manager cert-manager jetstack/cert-manager --set installCRDs=true`{{exec}}

Run `helm repo add fluxcd-community https://fluxcd-community.github.io/helm-charts`{{exec}}

### Install fluxcd

RUN `cat fluxcd.yaml | helm install fluxcd fluxcd-community/flux2 --version 2.7.0 -n fluxcd-system --create-namespace -f -`{{exec}}
3 changes: 3 additions & 0 deletions install-kurator/step2/verify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

kubectl get po -A
19 changes: 19 additions & 0 deletions install-kurator/step3/text.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Install Kurator

- Update Helm Repo

RUN `helm repo add kurator https://kurator-dev.github.io/helm-charts && helm repo update`{{exec}}

- Install `cluster-operator` and `fleet-manager`

RUN `helm install --create-namespace kurator-cluster-operator kurator/cluster-operator --version=0.6.0 -n kurator-system`{{exec}}

RUN `helm install --create-namespace kurator-fleet-manager kurator/fleet-manager --version=0.6.0 -n kurator-system`{{exec}}

- Check kurator Resource

RUN `kubectl get pod -A`{{exec}}

The following example is output, indicating that the addition was successful

![Scan results](../image/success.png)
3 changes: 3 additions & 0 deletions install-kurator/step3/verify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

kubectl get po -n kurator-system

0 comments on commit 6f66bfb

Please sign in to comment.