Development/Docker&Kubernetes (40) 썸네일형 리스트형 쿠버네티스 입문 - 6장 컨트롤러 Controller 개념 Pod 를 관리하는 역학을 한다. Replicatoin Controller(레플리케이션 컨트롤러), ReplicaSet(레플리카 셋) Replication Contller 초기부터 있었던 기본적인 컨트롤러 명시한 Pod 개수만큼 유지하도록 해준다. 현재는 ReplcaSet 을 쓴다. ReplicaSet 레플리케이션 컨트롤러의 발전형. 레플리케이션 컬트롤러와 차이점은 집합기반 셀렉터를 지원 한다. (in, notin, exists) rolling-update 옵션 사용불가 설정 apiVersion: v1 kind: ReplicaSet metadata: name: nginx-replicaset spec: template: metadata: name: nginx-replicaset l.. 쿠버네티스 입문 - 5장 파드 Pod 개념 쿠버네티스에서 실제로 컨테이너를 묶어서 관리하는 단위 설정 apiVersion: v1 kind: Pod metadata: name: simple-pod (Pod 이름) labels: app: simple-pod (오브젝트를 식별하는 레이블) spec: containers: - name: simple-pod (컨테이너 이름) image: ~~~ (컨네이너에서 사용할 이미지) ports: - containerPort: 8080 Pod 생명주기 Pending -> Running Successed Failed Unknown 컨테이너 진단 ivenessProbe 컨테이너가 실행됐는지 확인 실패시 컨테이너를 종료시키고 재시작 정책에 따라서 재시작 readinessProbe 컨테이너 실행된 후 실제로 서.. [K8S] affinity 를 이용해서 노드 중복 피하기. 현재 시스템의 구성은 다음과 같다 MasterNode, Worker1, Worker2 여기에 테스트를 위해서 mysql 을 열려놨다. 해당 yaml 은 다음과 같다. apiVersion: apps/v1 kind: Deployment metadata: namespace: spring name: deploy-mysql labels: app: mysql spec: replicas: 2 selector: matchLabels: app: mysql template: metadata: labels: app: mysql spec: containers: - name: mysql image: mysql:5.7 env: - name: MYSQL_ROOT_PASSWORD valueFrom: secretKeyRef: name.. [K8S] PV & PVC 1. PV (Persistent Volume) - PV는 클러스터 리소스 이다. - volumeModes Filesystem : Pod 의 디렉토리에 마운트 된다. Block - PersistentVolumeReclaimPolicy (PVC 삭제시 PV 데이터에 대한 정책) - Retail : 그대로 보존 - Recycle : 재사용시 기존 pv 데이터들 삭제 후 재사용 (이건 사용 안함) - Delete : 볼륨 삭제 - RecaimPolicy Update kubectl patch pv -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}' 2. PVC (Persistent Volume Claim) pv 와 pvc 는 1:1 바인딩이며 pvc 가 요청하는 .. [K8S] Kubernetes 설치시 오류 조치 [K8S] ## K8S 설치시 Trouble Shooting - kubeadm init 했는데 다음과 같이 나오는 경우 [wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s [kubelet-check] Initial timeout of 40s passed. Unfortunately, an error has occurred: timed out waiting for the condition This error is likely caused by: - The kubelet is not.. [K8S] Virtual Box 에 Kubernetes 설치하기 몇번의 시도 끝에 Virtual Box 에 Kubernetes 설치를 성공했다. 총 Master1 개, Worker 2 개로 구성을 했다. 1. Virtual BOX 환경설정 - 네트워크 - 네트워크 이름 : k8s-network - 네트워크 CIDR : 10.0.1.0/24 - 네트워크 옵션 : DHCP 지원 체크 2. Machine 설정 (화면캡쳐 없음 ㅠㅠ) - 일반 : 고급 - 클립보드 공유 : 양방향 - 드래그 앤 드롭 : 양방향 - 시스템 : 프로세서 - 개수 : 2 - 네트워크 : 어댑터 1 - 다음에 연결됨 : Nat 네트워크 - 이름 : k8s-network (미리 만들어야된다.) - 네트워크 : 어댑터 2 - 다음에 연결됨 : Nat - 공유폴더 (Optional) - 폴더 설정, 마운.. VirtualBox 에 Kubernetes 올리기(k3s) https://coffeewhale.com/kubernetes/cluster/virtualbox/2020/08/31/k8s-virtualbox/ 1. Virtual Box 설치 & 설정 총 3대의 VM. (master, worker1, worker2) 2. 인증서 있을경우 - /usr/local/share/ca-certificates 에 인증서 파일 copy - sudo udpate-ca-certificates 3. PROXY 존재할 경우 /etc/environment 파일에 proxy 설정 export https_proxy=http://IP:PORT export http_proxy=http://IP:PORT 4. 토큰 sudo cat /var/lib/rancher/k3s/server/token K105.. 맥북에 도커 설치. 도커 설치할 일이 었어서 맥북에 도커를 설치했는데 정말 간단하게 설치가 됐다. 1. 도커 다운로드 https://www.docker.com/get-started Get Started with Docker | Docker Learn about the complete container solution provided by Docker. Find information for developers, IT operations, and business executives. www.docker.com 여기 가면 운영체제에 맞는 도커를 다운 받을 수 있다. 2. 설치 설치는 다른 어플리케이션 설치 하듯이 간단히 드래그 & 드랍으로 하면 된다. 3. 설치가 된후 Start 를 누르면 아래와 같은 화면이 나온다. 도커를 사.. [K8S] Kubernetes secret 생성 ingress 에 tls 에서 사용되는 인증서가 만료되어서 secret 을 생성 해야 할 경우 다음과 같이 생성하면된다. 인증서와 key 파일은 있다고 가정한다. 없다면 다음 글을 참고하면 된다. 2018/08/22 - [Development/Tech&Seminar] - Openssl로 SSL 을 위한 인증서 발급하기 (HTTPS) secret 이름은 my-secret 이라고 가정하고 dev 네임스페이스에 생성되어있다고 가정한다. 1. 기존 secret 삭제 kubectl delete secret my-secret -n dev 2. secret 생성 kubectl create secret tls my-secret --key my.key --cert my.crt -n dev 이렇게 하면 끝난다. 이미 in.. Docker build 할때 parameter 처리 방법 Spring boot Application 을 Dockerfile 로 build 할 때에 profile 값을 전달 해야해서 찾아본 것을 적어보았다. profile 값을 전달하기 위해서는 다음과 같은 방법들이 있다. 1.Dockerfile 에 profile 값을 넣고 build 를 한다. FROM java:8 ADD target/app.jar app.jar RUN bash -c 'touch /app.jar' ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom","-Dspring.profiles.active=dev","-jar","/app.jar"] 2.Docker run 할때 환경 변수로 전달한다. docker run -d -p 8080:8080 -.. 이전 1 2 3 4 다음