-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-hello.sh
executable file
·52 lines (44 loc) · 941 Bytes
/
run-hello.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
REPO=localhost:5000
TAG=hello-world
docker pull $TAG
# give it a bogus tag
docker tag $TAG ${REPO}/$TAG:1.2.3
docker push ${REPO}/$TAG:1.2.3
if [ ! -f hello.yaml ]; then
cat <<EOF > hello.yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
app: $TAG
name: $TAG
spec:
containers:
- image: $REPO/$TAG:1.2.3
name: $TAG
resources: {}
restartPolicy: Never
status: {}
EOF
fi
kubectl apply -f hello.yaml
for i in `seq 1 5`; do
sleep .5
kubectl logs $TAG
done
cleanup() {
trap - 0 1 2 3 15 21 22
cat <<-EOF
If you see the following above:
Hello from Docker!
This message shows that your installation appears to be working correctly.
GREAT! Your registry is accessible to k3s
otherwise, something went wrong.
EOF
kubectl delete -f hello.yaml
}
trap cleanup 0 1 2 3 15 21 22
echo "ctrl-c to quit, otherwise in 15 seconds it'll quit"
sleep 15s