#!/bin/bash

mkdir /root/.kube
cp kube_config_cluster.yml /root/.kube/config

kubectl apply -f k8s-dashboard.yaml
kubectl delete -f k8s-dashboard.yaml

kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')

kubectl apply -f k8s-nfs.yaml
kubectl delete -f k8s-nfs.yaml

kubectl -n kube-system describe pod $(kubectl -n kube-system get pods | grep nfs-client-provisioner |  awk '{print$1}')

kubectl apply -f k8s-nfs-test.yaml
kubectl delete -f k8s-nfs-test.yaml

cd /var/lib/docker/nfs_data

kubectl apply -f k8s-pvc.yaml
kubectl delete -f k8s-pvc.yaml

kubectl apply -f k8s-mongo.yaml
kubectl delete -f k8s-mongo.yaml

vim k8s-emqx.yaml
kubectl apply -f k8s-emqx.yaml
kubectl delete -f k8s-emqx.yaml

kubectl apply -f k8s-rabbitmq.yaml
kubectl delete -f k8s-rabbitmq.yaml

kubectl apply -f k8s-redis.yaml
kubectl delete -f k8s-redis.yaml

kubectl apply -f k8s-mysql.yaml
kubectl delete -f k8s-mysql.yaml

----

kubectl apply -f k8s-nacos.yaml
kubectl delete -f k8s-nacos.yaml

---

vim k8s-configmap.yaml
kubectl apply -f k8s-configmap.yaml
kubectl delete -f k8s-configmap.yaml

vi k8s-ingress.yaml
kubectl apply -f k8s-ingress.yaml
kubectl delete -f k8s-ingress.yaml

vi k8s-frontend.yaml
kubectl apply -f k8s-frontend.yaml
kubectl delete -f k8s-frontend.yaml

vi k8s-backend.yaml
kubectl apply -f k8s-backend.yaml
kubectl delete -f k8s-backend.yaml


kubectl -n kube-system get pods -o jsonpath='{.items[*].metadata.name}' 

vi k8s-srs.yaml
kubectl apply -f k8s-srs.yaml
kubectl delete -f k8s-srs.yaml