167 lines
5.5 KiB
Bash
Executable File
167 lines
5.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
## For debugging
|
|
# set -eux
|
|
|
|
|
|
# wait few seconds to ensure k3s server is ready
|
|
sleep 60
|
|
|
|
|
|
#############################
|
|
### DEV PACKAGES
|
|
#############################
|
|
export RAKE_VER=0.1.7
|
|
|
|
curl -L https://$PRIVATE_GIT_TOKEN@registry.vegastar.vn/vegacloud/make/releases/download/$RAKE_VER/rake-$RAKE_VER-x86_64-unknown-linux-musl.tar.gz | tar xzv -C /tmp/
|
|
sudo install -o root -g root -m 0755 /tmp/rake-$RAKE_VER-x86_64-unknown-linux-musl/rake /usr/local/bin/rake
|
|
|
|
#############################
|
|
### KUBECTL
|
|
#############################
|
|
|
|
## Config kubectl
|
|
mkdir -p ~/.kube
|
|
cp ${PWD}/.devcontainer/kubeconfig.yaml ~/.kube/config
|
|
sed -i 's/127.0.0.1/k3s-server/g' ~/.kube/config
|
|
|
|
## allow insecure connection
|
|
shopt -s expand_aliases
|
|
echo 'alias kubectl="kubectl --insecure-skip-tls-verify"' >> ~/.bashrc
|
|
echo 'alias k="kubectl --insecure-skip-tls-verify"' >> ~/.bashrc
|
|
|
|
#############################
|
|
### K9S
|
|
#############################
|
|
|
|
# install k9s
|
|
wget https://github.com/derailed/k9s/releases/download/v0.50.6/k9s_linux_amd64.deb -O /tmp/k9s_linux_amd64.deb
|
|
sudo dpkg -i /tmp/k9s_linux_amd64.deb
|
|
|
|
#############################
|
|
### NGINX INGRESS
|
|
#############################
|
|
|
|
# kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-$NGINX_INGRESS_VER/deploy/static/provider/cloud/deploy.yaml
|
|
# cat <<EOT >> /tmp/nginx-service.yaml
|
|
# apiVersion: v1
|
|
# kind: Service
|
|
# metadata:
|
|
# name: ingress-nginx-controller-loadbalancer
|
|
# namespace: ingress-nginx
|
|
# spec:
|
|
# selector:
|
|
# app.kubernetes.io/component: controller
|
|
# app.kubernetes.io/instance: ingress-nginx
|
|
# app.kubernetes.io/name: ingress-nginx
|
|
# ports:
|
|
# - name: http
|
|
# port: 80
|
|
# protocol: TCP
|
|
# targetPort: 80
|
|
# - name: https
|
|
# port: 443
|
|
# protocol: TCP
|
|
# targetPort: 443
|
|
# type: LoadBalancer
|
|
# EOT
|
|
# kubectl apply -f /tmp/nginx-service.yaml
|
|
# rm -f /tmp/nginx-service.yaml
|
|
|
|
#############################
|
|
### OPEN TELEMETRY
|
|
#############################
|
|
# kubectl create namespace $JAEGER_NAMESPACE
|
|
# kubectl create namespace $OPENTELEMETRY_NAMESPACE
|
|
|
|
# ## cert-manager
|
|
# kubectl apply -f https://github.com/jetstack/cert-manager/releases/latest/download/cert-manager.yaml
|
|
|
|
# ## install jaeger
|
|
# helm repo add jaegertracing https://jaegertracing.github.io/helm-charts
|
|
# helm install jaeger jaegertracing/jaeger -n $JAEGER_NAMESPACE
|
|
# kubectl -n $JAEGER_NAMESPACE get po
|
|
|
|
# ## open telemetry operator
|
|
# kubectl apply -f https://github.com/open-telemetry/opentelemetry-operator/releases/latest/download/opentelemetry-operator.yaml
|
|
|
|
# ## create an OpenTelemetry Collector instance
|
|
# kubectl -n $OPENTELEMETRY_NAMESPACE apply -f .devcontainer/helm/opentelemetry-collector.yaml
|
|
|
|
#############################
|
|
### FISSION PODs
|
|
#############################
|
|
kubectl create namespace $FISSION_NAMESPACE
|
|
|
|
# ## install with helm
|
|
# kubectl create -k "github.com/fission/fission/crds/v1?ref=${FISSION_VER}"
|
|
# helm repo add fission-charts https://fission.github.io/fission-charts/ && helm repo update
|
|
# kubectl apply -f - <<EOF
|
|
# apiVersion: v1
|
|
# kind: Namespace
|
|
# metadata:
|
|
# name: fission
|
|
# ---
|
|
# apiVersion: v1
|
|
# kind: Namespace
|
|
# metadata:
|
|
# name: gh-eom
|
|
# EOF
|
|
# kubectl apply -f - <<EOF
|
|
# type: kubernetes.io/dockerconfigjson
|
|
# apiVersion: v1
|
|
# kind: Secret
|
|
# metadata:
|
|
# name: vega-container-registry
|
|
# namespace: fission
|
|
# data:
|
|
# .dockerconfigjson: >-
|
|
# eyJhdXRocyI6eyJyZWdpc3RyeS52ZWdhc3Rhci52biI6eyJ1c2VybmFtZSI6InRpZW5kZCIsInBhc3N3b3JkIjoiYTBjY2JjMDVjNzMyYzExMjU3OTg1NjMwNjY5ZTFjNjEyNDg0NzU1MyIsImF1dGgiOiJkR2xsYm1Sa09tRXdZMk5pWXpBMVl6Y3pNbU14TVRJMU56azROVFl6TURZMk9XVXhZell4TWpRNE5EYzFOVE09In19fQ==
|
|
# EOF
|
|
# helm upgrade --install fission fission-charts/fission-all --namespace $FISSION_NAMESPACE -f - <<EOF
|
|
# imagePullSecrets:
|
|
# - name: vega-container-registry
|
|
# defaultNamespace: default
|
|
# additionalFissionNamespaces:
|
|
# - gh-eom
|
|
# EOF
|
|
|
|
## install without helm
|
|
kubectl create -k "github.com/fission/fission/crds/v1?ref=${FISSION_VER}"
|
|
kubectl create namespace $FISSION_NAMESPACE
|
|
kubectl config set-context --current --namespace=$FISSION_NAMESPACE
|
|
kubectl apply -f https://github.com/fission/fission/releases/download/${FISSION_VER}/fission-all-${FISSION_VER}-minikube.yaml
|
|
kubectl config set-context --current --namespace=default #to change context to default namespace after installation
|
|
|
|
|
|
#############################
|
|
### PROMETHEUS AND GRAFANA
|
|
#############################
|
|
# kubectl create namespace $METRICS_NAMESPACE
|
|
|
|
# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts && helm repo update
|
|
# helm install prometheus prometheus-community/kube-prometheus-stack -n $METRICS_NAMESPACE
|
|
|
|
#############################
|
|
### UPDATE FISSION
|
|
#############################
|
|
|
|
# helm upgrade fission fission-charts/fission-all --namespace $FISSION_NAMESPACE -f .devcontainer/helm/fission-values.yaml
|
|
|
|
#############################
|
|
### PORT FORWARDING
|
|
#############################
|
|
|
|
## To access jaeger-query, you can use Kubernetes port forwarding
|
|
# kubectl -n jaeger port-forward svc/jaeger-query 8080:80 --address='0.0.0.0'
|
|
## To access kabana, you can use Kubernetes port forwarding
|
|
# kubectl --namespace monitoring port-forward svc/prometheus-grafana 3000:80
|
|
## For password, you'll need to run the following command:
|
|
# kubectl get secret --namespace monitoring prometheus-grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
|
|
|
|
#############################
|
|
### INSTALLING PYTHON PACKAGES
|
|
#############################
|
|
|
|
pip install -r dev-requirements.txt -r src/requirements.txt
|