-
k8s 저장소 = 볼륨
emptydir : 한 pod안에서 컨테이너들이 공유 . 임시
hostpath : 한 노드안에서 pod들이 공유 . 영구, 노드가 변경되면 공유 불가
--> 로컬(node) 볼륨docker build -t myoungseok/count .
docker push
bash count script
#!/bin/bash
trap "exit" SIGINT
mkdir /var/htdocs
SET=$(seq 0 99999)
for i in $SET
do
echo "Runing loop seq "$i > /var/htdocs/index.html
sleep 3
doneapiVersion: v1
kind: Pod
metadata:
name: count
spec:
containers:
- image: myoungseok/count
name: html-generator # count.sh 에서 만든 파일
volumeMounts:
- mountPath: /var/htdocs
name: html
- image: httpd # apache2
name: web-server
volumeMounts:
- mountPath: /usr/local/apache2/htdocs
name: html
readOnly: true
ports:
- containerPort: 80
protocol: TCP
volumes:
- name: html
emptyDir:
sizeLimit: 500Mi
imagePullSecrets:
- name: qwerkubectl describe pod/count
kubectl create secret docker-registry qwer --docker-username=qkrwo8520 --docker-password=qkr35584578
kubectl create deploy http-go --image=qkrwo8520/http-go
kubectl exec -it http-go --curl 10.0.2.130
kubectl exec -it count -c web-server -- ls -la /usr/local/apache2/htdocs
kubectl exec -it count -c web-server -- cat /usr/local/apache2/htdocs/index.html