pve_tests/run.sh

63 lines
1.2 KiB
Bash
Executable File

#!/bin/sh -exu
branch="${1:-"sisyphus"}"
task_number="${2-}"
rsync hosts root@10.4.4.162:/etc/hosts
rsync hosts root@10.4.4.125:/etc/hosts
rsync hosts root@10.4.4.193:/etc/hosts
ssh root@10.4.4.162 "systemctl restart network"
ssh root@10.4.4.125 "systemctl restart network"
ssh root@10.4.4.193 "systemctl restart network"
#rm -f hosts
ansible-playbook ansible/playbook.yaml -i ansible/inventory.yaml \
-e task_number="$task_number"
#rm -f kubeadm-join-command
rsync root@10.4.4.162:/etc/kubernetes/admin.conf ~/.kube/config
kubectl apply -f - <<'EOF'
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
replicas: 2 # tells deployment to run 2 pods matching the template
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: obirvalger/my
ports:
- containerPort: 80
EOF
kubectl apply -f - <<'EOF'
apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
app: nginx
spec:
type: NodePort
ports:
- port: 80
targetPort: 80
nodePort: 30007
selector:
app: nginx
EOF
sleep 180
curl 10.4.4.162:30007
kubectl exec $(kubectl get po | awk 'END{print $1}') -- nslookup nginx