This repository has been archived by the owner on Apr 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
k8s env setup guide and script #128
Open
yanmo96
wants to merge
6
commits into
futurewei-cloud:main
Choose a base branch
from
yanmo96:env_deployment_setup
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b8b48e8
k8s env setup guid and script
yanmo96 5925022
update the doc
yanmo96 3bc3448
Added linkerd install steps
yanmo96 9dd964b
Added linkerd install steps
yanmo96 4b596c8
Added meshnet install steps
yanmo96 63e0385
added more deploy setups
yanmo96 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
# This doc is for set up the k8s env | ||
Suggest to put this on the k8s control node. | ||
### The scripts can: | ||
1. Install k8s | ||
2. Pull docker images | ||
3. Install dependencies on each compute node | ||
4. Remove `/root/work/` folder on each compute node | ||
|
||
### First need to install ansible in venv: | ||
___ | ||
|
||
``` | ||
sudo apt update | ||
sudo apt upgrade | ||
sudo apt install python3-dev python3-venv libffi-dev gcc libssl-dev git | ||
|
||
python3 -m venv ansible | ||
source ansible/bin/activate | ||
|
||
pip install -U pip | ||
pip install 'ansible<2.10' | ||
``` | ||
|
||
### Set up k8s | ||
___ | ||
|
||
Run: | ||
`ansible-playbook -i aws-host kube-dependencies.yml` | ||
|
||
After the above command, run the follow to init k8s on the master node: | ||
`kubeadm init --pod-network-cidr=10.244.0.0/16` | ||
|
||
Then run and put the follow line in `.profile` to be able to manage k8s: | ||
`export KUBECONFIG=/etc/kubernetes/admin.conf` | ||
|
||
To install flannel: | ||
`kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml` | ||
|
||
All done with k8s setup! | ||
|
||
## Install other dependencies like ovs: | ||
___ | ||
|
||
`ansible-playbook -i aws-host prepare_machine.yml` | ||
The current `prepare_machine.yml` file will also install python and python-docker, which then used for pulling docker images later. | ||
|
||
## Pull docker images: | ||
___ | ||
|
||
`ansible-playbook -i aws-host pull_image.yml` | ||
|
||
## Install Linkerd: | ||
___ | ||
|
||
To install Linkerd, can follow the link or commands below: | ||
|
||
https://linkerd.io/2.12/getting-started/ | ||
|
||
- Install the Linkerd CLI: | ||
- `curl --proto '=https' --tlsv1.2 -sSfL https://run.linkerd.io/install | sh` | ||
- Export the Linkerd path: | ||
- `export PATH=$PATH:/home/ubuntu/.linkerd2/bin` | ||
- Validate Kubernetes cluster: | ||
- `linkerd check --pre` | ||
- Install Linkerd: | ||
- `linkerd install --crds | kubectl apply -f -` | ||
- `linkerd install | kubectl apply -f -` | ||
- Check if Linkerd is installed properly: | ||
- `linkerd check` | ||
|
||
## Install Meshnet | ||
___ | ||
|
||
``` | ||
git clone https://github.com/networkop/meshnet-cni.git | ||
cd meshnet | ||
kubectl apply -k manifests/base | ||
``` | ||
|
||
## Install Temporal | ||
___ | ||
``` | ||
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash | ||
git clone https://github.com/temporalio/helm-charts.git | ||
cd helm-charts/ | ||
helm dependencies update | ||
|
||
helm install \ | ||
--set server.replicaCount=20 \ | ||
--set cassandra.config.cluster_size=5 \ | ||
--set prometheus.enabled=false \ | ||
--set grafana.enabled=false \ | ||
--set elasticsearch.enabled=false \ | ||
temporaltest . --timeout 25m | ||
|
||
cd ~ | ||
git clone https://github.com/temporalio/tctl.git | ||
cd tctl | ||
make | ||
|
||
# in a new window, or in screen run | ||
kubectl port-forward services/temporaltest-frontend 7233:7233 | ||
|
||
# back to the main window | ||
./tctl namespace register | ||
``` | ||
|
||
## Install Alcor | ||
``` | ||
# install alcor | ||
./alcor_kubernetes/createYaml.sh | ||
|
||
# after deploy run create default talble | ||
./alcor_kubernetes/createDefaultTable.sh | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- hosts: workers | ||
become: yes | ||
tasks: | ||
- name: join cluster | ||
shell: "kubeadm join 172.31.52.142:6443 --token xbgvlb.el3strzd70iirrp9 --discovery-token-ca-cert-hash sha256:46bc105f5d2c515552ac0706bb8385804c6775dd2a46a2c45a137acc95f286bf" |
1 change: 1 addition & 0 deletions
1
deployments/env_setup/kube-cluster/alcor_kubernetes/createDefaultTable.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
curl -X POST -H "Content-Type: application/json" -H "Accept: */*" "http://localhost:30001/segments/createDefaultTable" |
112 changes: 112 additions & 0 deletions
112
deployments/env_setup/kube-cluster/alcor_kubernetes/createYaml.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# MIT License | ||
# Copyright(c) 2020 Futurewei Cloud | ||
# | ||
# Permission is hereby granted, | ||
# free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal in the Software without restriction, | ||
# including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons | ||
# to whom the Software is furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
|
||
#!/bin/bash | ||
|
||
# Install prerequisites | ||
if [[ "$OSTYPE" == "linux-gnu" ]]; then | ||
|
||
echo "Create ignite yaml files" | ||
|
||
for d in db/ignite/*.yaml; | ||
do | ||
kubectl create -f $d | ||
echo "Create ignite yaml - $d completed" | ||
done | ||
|
||
echo "Create yaml files done" | ||
|
||
|
||
numberOfRnningPods="foo" | ||
numberOfAllPods="bar" | ||
|
||
while [ "$numberOfRnningPods" != "$numberOfAllPods" ]; | ||
do | ||
sleep 10s | ||
numberOfRnningPods=$(kubectl get pods -A --field-selector=status.phase=Running | wc -l) | ||
numberOfAllPods=$(kubectl get pods -A | wc -l) | ||
echo "numberOfRnningPods: " "$numberOfRnningPods" | ||
echo "numberOfAllPods: " "$numberOfAllPods" | ||
done | ||
|
||
kubectl exec -it ignite-alcor-0 -n ignite-alcor -c ignite-alcor-node -- /opt/ignite/apache-ignite/bin/control.sh --activate | ||
kubectl exec -it ignite-alcor-ip-0 -n ignite-alcor-ip -c ignite-alcor-ip-node -- /opt/ignite/apache-ignite/bin/control.sh --activate | ||
kubectl exec -it ignite-alcor-mac-0 -n ignite-alcor-mac -c ignite-alcor-mac-node -- /opt/ignite/apache-ignite/bin/control.sh --activate | ||
kubectl exec -it ignite-alcor-port-0 -n ignite-alcor-port -c ignite-alcor-port-node -- /opt/ignite/apache-ignite/bin/control.sh --activate | ||
kubectl exec -it ignite-alcor-dpm-0 -n ignite-alcor-dpm -c ignite-alcor-dpm-node -- /opt/ignite/apache-ignite/bin/control.sh --activate | ||
kubectl exec -it ignite-alcor-ncm-0 -n ignite-alcor-ncm -c ignite-alcor-ncm-node -- /opt/ignite/apache-ignite/bin/control.sh --activate | ||
|
||
|
||
#cd apache-ignite/bin/ | ||
#./control.sh --activate | ||
|
||
echo "ignite cluster has been activated" | ||
|
||
for d in services/*.yaml; | ||
do | ||
kubectl create -f $d | ||
echo "Create services yaml - $d completed" | ||
done | ||
|
||
echo "Cluster has been created" | ||
|
||
elif [[ "$OSTYPE" == "darwin"* ]]; then | ||
echo "Install prerequisites in Mac OSX" | ||
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | ||
brew install maven | ||
|
||
# echo "Clean build legacy controller project" | ||
# mvn clean | ||
# mvn compile | ||
# mvn install -Dmaven.test.skip=true | ||
|
||
echo "Clean build common library project" | ||
cd lib | ||
mvn clean | ||
mvn compile | ||
mvn install -Dmaven.test.skip=true | ||
cd .. | ||
|
||
echo "Clean build web project" | ||
cd web | ||
mvn clean | ||
mvn compile | ||
mvn install -Dmaven.test.skip=true | ||
cd .. | ||
|
||
echo "Build service one by one under services directory" | ||
cd services | ||
for d in ./*/; | ||
do | ||
echo "Build service - $d" | ||
cd $d | ||
mvn clean | ||
mvn compile | ||
mvn install -Dmaven.test.skip=true | ||
cd .. | ||
echo "Build service - $d completed" | ||
done | ||
|
||
elif [[ "$OSTYPE" == "cygwin" ]]; then | ||
# POSIX compatibility layer and Linux environment emulation for Windows | ||
echo "Install prerequisites in Linux environment of Windows" | ||
elif [[ "$OSTYPE" == "msys" ]]; then | ||
# Lightweight shell and GNU utilities compiled for Windows (part of MinGW) | ||
echo "Install prerequisites in MinGW of Windows" | ||
else | ||
echo "Unknown supported OS" | ||
fi | ||
|
||
echo "Build completed" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yanmo96 Explain what is
aws-host
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aws-host is a file with a list of hosts and their config for ansbile to run on. I can change the name to just
hosts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yanmo96 yes, please change it to hosts.