본문 바로가기

728x90
반응형

Development/Docker&Kubernetes

(38)
[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 -..
[K8S] Kubernetes Nginx Controller 에 TLS 설정하다 생긴일.... 최근에 Kubernetes에 어플리케이션을 올리다가 몇일간 맨붕 상태가 온 내용을 남겨두고자 한다. Kubernetes 클러스터에 my-test1 이라는 네임스페이스로 ingress, servcie, deployment 를 생성하였다. 여기 까지는 문제가 없었는데 도메인을 설정하고 tls 를 설정하면서 문제가 발생했다. 1. test.com 이라는 도메인으로 사설 인증서 생성. 2. crt 파일과 key 파일을 이용해서 secret 생성 3. ingress 에 tls 설정에 host와 tls 를 설정. 위와같이 진행을 하고 접속을 해봤다. 그런데 이상하게 브라우저에서 "주의요함" 부분을 클릭해보면 내가 만든 사설인증서의 도메인이 나오는게 아니라 Kubernetes의 Fake 인증서가 나왔다. 분명히 나는..
[K8S] Replica Set vs Replication Controller 차이 ReplicaSet 은 Replicatation Controller 의 새로운 버전이다. 다른것은 다 동일한데 아래와 같은 차이점이 존재 한다. ReplcaSet : Set-based Selectors Replicatation Controller : Equality-based Selectors Equality-based Set-based support Service, Replication Controller Job, Deployment, ReplicaSet, Daemon Set Operation =, ==, != in, notin, exists Example enviroment=prd enviroment in (prd) Command Line kubectl get pods -l enviroment=prd..

728x90
반응형