반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- mount
- MSBing
- ssh
- ansible
- M365필터
- 랜카드인식불량
- lvcreate
- newbingai
- permission
- Kubernetes
- docker
- docker network
- yum
- chatGPT
- chmod
- 같은폴더
- 엑셀파일명변경
- vagrant kubernetes
- pvcreate
- nmcli
- tar
- vgcreate
- 프로세스
- docker image
- firewalld
- journalctl
- 날짜변경
- swapon
- 리다이렉션
- HTTPD
Archives
- Today
- Total
becool
20210826 (목) 교재 제공 예제파일 활용 - git 본문
반응형
책 : 완벽한 IT 인프라 구축의 자동화를 위한 Kubernetes
지은이 : Asa shiho
이 교재에서는 예제파일들을 git clone을 통하여 쉽게 구하고 활용할 수 있게 되어있다.
그 중 자주 쓰이는 이미지를 자신의 docker hub에 업로드하고 활용하면 된다.
※ 참고로 책에는 azure 레포지토리에 저장하고 sampleacrregistry.azurecr.io 로 표시하고 있음.
※ os image : ubuntu/focal64 (virtualbox, 20210816.0.0) (vagrant box)
※ kubeadm 배포도구로 설치된 환경
##### 1.도커 허브 로그인 #####
→ 본인의 도커허브 아이디로 로그인
vagrant@kube-control1:~ $ docker login
Login with your Docker ID to push and pull images from Docker Hub. If you dont have a Docker ID, head over to https://hub.docker.com to create one.
Username: 도커허브ID
Password: 도커허브PW
##### 2. 깃 클론 #####
→ 교재에서 제공하는 주소로 부터 clone
vagrant@kube-control1:~ $ git clone https://github.com/ToruMakabe/Understanding-K8s
Cloning into 'Understanding-K8s'...
remote: Enumerating objects: 1732, done.
remote: Total 1732 (delta 0), reused 0 (delta 0), pack-reused 1732
Receiving objects: 100% (1732/1732), 835.09 KiB | 1.13 MiB/s, done.
Resolving deltas: 100% (981/981), done.
##### 3. 해당 디렉터리로 이동 및 이미지 빌드 #####
→ 교재에서는 photo-view:v1.0, photo-view:v2.0 두 가지 태그를 활용한다.
vagrant@kube-control1:~ $ cd Understanding-K8s/chap02/v1.0
vagrant@kube-control1:~/Understanding-K8s/chap02/v1.0$ sudo docker build -t photo-view:v1.0 .
Sending build context to Docker daemon 484.4kB
Step 1/11 : FROM python:3.6
3.6: Pulling from library/python
4c25b3090c26: Pull complete
… 후략
vagrant@kube-control1:~/Understanding-K8s/chap02/v1.0$ cd ../v2.0
vagrant@kube-control1:~/Understanding-K8s/chap02/v2.0$ sudo docker build -t photo-view:v2.0 .
Sending build context to Docker daemon 484.9kB
Step 1/11 : FROM python:3.6
---> 4b6c4a2e83f7
Step 2/11 : LABEL maintainer "Shiho ASA"
---> Using cache
---> c429e6664859
Step 3/11 : RUN pip install --upgrade pip
---> Using cache
---> b1c92aebde8a
Step 4/11 : ENV APP_PATH /opt/photoview
---> Using cache
---> e4819a6dd9a3
… 후략
##### 4. 이미지 확인 (이미지 생성) #####
vagrant@kube-control1:~/Understanding-K8s/chap02/v2.0$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
photo-view v2.0 a1ac7bcbc843 10 seconds ago 913MB
photo-view v1.0 6ec18c6b5159 About a minute ago 913MB
##### 5. 태그 설정 #####
→ ID/IMAGE_NAME:tag 순서로 태그를 작성
vagrant@kube-control1:~/Understanding-K8s/chap02/v2.0$ sudo docker image tag photo-view:v1.0 아이디/photo-view:v1.0
vagrant@kube-control1:~/Understanding-K8s/chap02/v2.0$ sudo docker image tag photo-view:v2.0 아이디/photo-view:v2.0
##### 6. 이미지 확인 (태그변경) #####
vagrant@kube-control1:~/Understanding-K8s/chap02/v2.0$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
titiiscat/photo-view v2.0 a1ac7bcbc843 2 minutes ago 913MB
photo-view v2.0 a1ac7bcbc843 2 minutes ago 913MB
photo-view v1.0 6ec18c6b5159 4 minutes ago 913MB
titiiscat/photo-view v1.0 6ec18c6b5159 4 minutes ago 913MB
##### 7. 이미지 푸시 #####
vagrant@kube-control1:~/Understanding-K8s/chap02/v2.0$ sudo docker image push titiiscat/photo-view:v2.0
The push refers to repository [docker.io/titiiscat/photo-view]
566f05f5a4c5: Pushed
ee10b629838c: Pushed
…후략
vagrant@kube-control1:~/Understanding-K8s/chap02/v2.0$ sudo docker image push titiiscat/photo-view:v1.0
The push refers to repository [docker.io/titiiscat/photo-view]
6c37d6385664: Pushed
f6e0cb184ca1: Pushed
…후략
해당 레포지토리에 업로드된 이미지를 통해 kubernetes 예제에 활용할 수 있다.
ex. kubectl run exam1 --image titiiscat/photo-view:v1.0
ex. 매니페스트 파일에서 image : titiiscat/photo-view:v1.0
728x90
'kubernetes' 카테고리의 다른 글
20210830 (월) service의 종류 (0) | 2021.08.30 |
---|---|
20210827 (금) 컨트롤러 활용 (0) | 2021.08.27 |
20210826 (목) liveness, restartPolicy, replication controller (0) | 2021.08.26 |
20210825 (수) kubernetes application 관리 (0) | 2021.08.25 |
20210824 (화) kubectl 활용 (0) | 2021.08.24 |
Comments