docker build -t gasbugs/count .
docker push gasbugs/count
FROM busybox:latest
ADD count.sh /bin/count.sh
ENTRYPOINT /bin/count.sh
#!/bin/bash
trap "exit" SIGINT
mkdir /var/htdocs
SET=$(seq 0 99999)
for i in $SET
do
echo "Running loop seq " $i > /var/htdocs/index.html
sleep 10
done
count-httpd.yaml
apiVersion: v1
kind: Pod
metadata:
name: count
spec:
containers:
- image: gasbugs/count
name: html-generator
volumeMounts: # 각 파드에 마운트 설정
- name: html
mountPath: /var/htdocs
- image: httpd
name: web-server
volumeMounts: # 각 파드에 마운트 설정
- name: html
mountPath: /usr/local/apache2/htdocs
readOnly: true
ports:
- containerPort: 80
protocol: TCP
volumes: # 볼륨 설정
- name: html
emptyDir: { }
imkunyoung@master-1:~/volume$ kubectl create -f count-httpd.yaml
pod/count created
imkunyoung@master-1:~/volume$ kubectl get pods
NAME READY STATUS RESTARTS AGE
count 0/2 ContainerCreating 0 4s
imkunyoung@master-1:~/volume$ kubectl get pods -w
NAME READY STATUS RESTARTS AGE
count 0/2 ContainerCreating 0 9s
count 2/2 Running 0 18s
imkunyoung@master-1:~/volume$ kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
count 2/2 Running 0 39s 10.0.1.235 worker-2 <none> <none>
imkunyoung@master-1:~/volume$ curl 10.0.1.235:80
Running loop seq 3
imkunyoung@master-1:~/volume$ curl 10.0.1.235:80
Running loop seq 40