-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathvalidate-registry.sh
executable file
·45 lines (39 loc) · 1.04 KB
/
validate-registry.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
#!/bin/sh
set -o errexit
# pull a sample hello-app from remote registry
docker pull gcr.io/google-samples/hello-app:1.0
# tag the pulled docker image for local registry
docker tag gcr.io/google-samples/hello-app:1.0 localhost:5001/hello-app:1.0
# push the docker image to the local registry
docker push localhost:5001/hello-app:1.0
# deployment hello-server deployment on platformwale-worker2 node
kubectl apply -f - <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: hello-server
name: hello-server
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: hello-server
template:
metadata:
labels:
app: hello-server
spec:
nodeSelector:
role: app
containers:
- image: localhost:5001/hello-app:1.0
imagePullPolicy: IfNotPresent
name: hello-app
EOF
# sleep for the pod to be running
sleep 10
# retrieve the logs
podName=$(kubectl get po -n default --no-headers | grep hello-server | awk -F ' ' '{print $1}')
kubectl logs -n default "${podName}"