728x90
MiniKube Init
choco install minikube
minikube start
kubectl get po -A
minikube dashboard
kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.4
Docker
FROM ubuntu:16.04 #운영체제 정의
COPY helloworld /usr/local/bin #helloworld 파일을 도커 컨테이너 내부 경로에 저장
RUN chmod +x /usr/local/helloworld #COPY에서 저장한 파일에 대한 실행 권한 부여
CMD ["helloworld"] # 완성된 이미지를 도커컨테이너로 실행전 먼저 실행할 명령 정의
$ docker image build -t helloworld:latest .
$ docker container run helloworld:latest
docker-compose
docker swarm
docker service
docker stack
FROM : Docker Base Image (기반이 되는 이미지, <이미지 이름>:<태그> 형식으로 설정)
MAINTAINER : 메인테이너 정보 (작성자 정보)
RUN : Shell Script 또는 명령을 실행
CMD : 컨테이너가 실행되었을 때 명령이 실행
LABEL : 라벨 작성 (docker inspect 명령으로 label 확인할 수 있습니다.)
EXPOSE : 호스트와 연결할 포트 번호를 설정한다.
ENV : 환경변수 설정
ADD : 파일 / 디렉터리 추가
COPY : 파일 복사
ENTRYPOINT : 컨테이너가 시작되었을 때 스크립트 실행
VOLUME : 볼륨 마운트
USER : 명령 실행할 사용자 권한 지정
WORKDIR : "RUN", "CMD", "ENTRYPOINT" 명령이 실행될 작업 디렉터리
ARG : Dockerfile 내부 변수
ONBUILD : 다른 이미지의 Base Image로 쓰이는 경우 실행될 명령 수행
SHELL : Default Shell 지정
Options:
--add-host list Add a custom host-to-IP mapping (host:ip)
--build-arg list Set build-time variables
--cache-from strings Images to consider as cache sources
--cgroup-parent string Optional parent cgroup for the container
--compress Compress the build context using gzip
--cpu-period int Limit the CPU CFS (Completely Fair Scheduler) period
--cpu-quota int Limit the CPU CFS (Completely Fair Scheduler) quota
-c, --cpu-shares int CPU shares (relative weight)
--cpuset-cpus string CPUs in which to allow execution (0-3, 0,1)
--cpuset-mems string MEMs in which to allow execution (0-3, 0,1)
--disable-content-trust Skip image verification (default true)
-f, --file string Name of the Dockerfile (Default is 'PATH/Dockerfile')
--force-rm Always remove intermediate containers
--iidfile string Write the image ID to the file
--isolation string Container isolation technology
--label list Set metadata for an image
-m, --memory bytes Memory limit
--memory-swap bytes Swap limit equal to memory plus swap: '-1' to enable unlimited swap
--network string Set the networking mode for the RUN instructions during build
(default "default")
--no-cache Do not use cache when building the image
--pull Always attempt to pull a newer version of the image
-q, --quiet Suppress the build output and print image ID on success
--rm Remove intermediate containers after a successful build (default true)
--security-opt strings Security options
--shm-size bytes Size of /dev/shm
-t, --tag list Name and optionally a tag in the 'name:tag' format
--target string Set the target build stage to build.
--ulimit ulimit Ulimit options (default [])
GCP
google cloud sdk 설치
->gcloud components install kubectl
->gcloud components update
gcloud auth login
gcloud config set project PROJECT_ID
gcloud config set compute/zone asia-northeast1-a
gcloud container clusters create taehyun --cluster-version=1.18.12-gke.1210 --machine-type=n1-standard-1 --num-nodes=3
gcloud container clusters get-credentials taehyun
kubectl get pods
kubectl get deployment
반응형
'Server Programming > DevOps' 카테고리의 다른 글
Minikube CLI (0) | 2022.02.04 |
---|---|
Kubernetes 대화형 튜토리얼 (0) | 2022.02.04 |
AWS - EC2 instance 생성 (0) | 2022.02.03 |
AWS - Route53 (0) | 2022.02.03 |
AWS - ELB (0) | 2022.02.03 |