Kubernetes 는 다양한 컴포넌트들로 인해서 작동된다. 이러한 컴포넌트들은 중요성에 있어서 약간의 차이가 있다. 예를들어 Worker Node 에서 docker 프로세스가 정지되거나 문제가 되었을때에 어떻게 될까? 혹은 Worker Node 에 kubelet 프로세스가 문제가 된다면? 이 문서는 Kubernetes 프로세스별 상태 에 대한 글이다. 환경 여기서 환경은 Kubernetes 의 객체를 말한다. 객체라함은 Pods, Deployments, Services, StatefulSet 으로 했다. 그밖에 다양한 객체가 있지만 이 정도 생성해서 진행해보기로 했다. docker 정지 이것은 Work Node 에 docker 를 정지 시키는 것이다. 이렇게 되었을때에 Kubernetes 의 각종 컴포넌트들은 […]
StatefulSet 에서 로컬 디스크 사용
이 문서는 StatefulSet 에서 로컬 디스크 사용 에 대한 글이다. Kubernetes 에서 디스크 사용은 어려운감이 있다. PersistentVolume 과 PersistentVolumeClaim 이라는 것을 알아야하고 이를 알고나서도 여러가지 속성들때문에 헷깔리는 경우가 많다. PersistentVolume 관련해서 문서를 보면 대부분 클라우드가 제공하는 스토리지를 이용하는 예제가 많다. 그것이 아니라면 nfs 를 이용하는 경우가 많아서 나처럼 집에 컴퓨터를 이용하는 경우에 실습해 보기가 쉽지 않은게 사실이다. StatefulSet 의 경우가 바로 이런 경우였다. StatefulSet 을 연구하기 위해서 여러가지 예제를 찾아봤고 다음과 같은 파일을 찾아냈다.
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
--- apiVersion: v1 kind: Service metadata: name: nginx namespace: perf-poc labels: app: nginx spec: ports: - port: 80 name: web clusterIP: None selector: app: nginx --- apiVersion: apps/v1 kind: StatefulSet metadata: name: web namespace: perf-poc spec: selector: matchLabels: app: nginx serviceName: "nginx" replicas: 2 template: metadata: labels: app: nginx spec: terminationGracePeriodSeconds: 10 containers: - name: nginx image: k8s.gcr.io/nginx-slim:0.8 ports: - containerPort: 80 name: web volumeMounts: - name: www mountPath: /usr/share/nginx/html nodeSelector: kubernetes.io/hostname: knode volumeClaimTemplates: - metadata: name: www namespace: perf-poc spec: accessModes: [ "ReadWriteOnce" ] resources: requests: storage: 1Gi |
StatefulSet 은 비상태(stateless) 자원을 생성하는게 […]
GitLab-Runner 설치
이 문서는 GitLab-Runner 설치 에 대한 것이다. GitLab 은 CI/CD 를 위해 외부 프로그램을 사용하는데, 이것이 바로 GitLab-Runner 이다. 외부 프로그램을 사용하기 때문에 반드시 GitLab 과 함께 있어야 하는것도 아니고 독립적으로 다양한 플랫폼에 설치해도 된다. 설치 설치는 아주 간단하다. 각 배포판, 플랫폼마다 패키지를 제공한다. 나는 Ubuntu 20.04 에 그것도 GitLab 서버에 설치할 예정이다. 다른 서버에 설치를 해도 되지만 테스트 삼아 설치하는 것이여서 이렇게 진행했다.
1 2 3 |
$ sudo apt install git # 의존성 설치 $ curl -LJO https://gitlab-runner-downloads.s3.amazonaws.com/latest/deb/gitlab-runner_amd64.deb $ sudo dpkg -i gitlab-runner_amd64.deb |
이렇게 설치를 하고 나면 /home/gitlab-runner 계정이 생성되며 systemd 에 gitlab-runner 서비스가 등록이되며 자동으로 실행이 된다. […]
GitLab 설치와 설정
GitLab 설치 하기. GitLab 은 무료로 사용가능한 git 저장소, ticket 시스템이다. github 의 오픈소스 버전으로 생각할 수 있지만 그것보다 많은 기능을 제공한다. 이 글에서는 gitlab 을 Ubuntu 20.04 LTS 에 설치와 설정에 대해서 알아보도록 하겠다. 준비 Gitlab 을 설치하기 전에 필요한 의존성 패키지들을 먼저 설치해 준다.
1 |
]$ sudo apt install -y ca-certificates curl |
메일을 사용할 경우에는 메일 서버를 설치해줘야 하지만 여기서는 제외한다. Gitlab 설치를 위한 저장소 추가 gitlab 홈페이지에서는 각 리눅스 배포판에 맞춰 스크립트를 제공한다. Ubuntu 20.04 를 위해 제공해주는 스크립트를 실행해 준다.
1 |
]$ sudo curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash |
Gitlab 설치 […]
virsh 를 통해 Ubuntu 20.04 에 console 로 접속하는 방법
KVM 가상화 시스템에서 virsh 를 통해 Ubuntu Guest OS에 Console 로 접속하는 방법은 다양한데 대부분 grub 부팅 옵션을 손보는 것이 였다. 하지만 Ubuntu 20.04 로 넘어오면서 이 방법이 훨씬 간단해 졌다. 먼저 Ubuntu 20.04 Guest 에 접속한 후에 다음과 같이 입력 하면 끝난다.
1 2 |
$ sudo systemctl enable serial-getty@ttyS0.service $ sudo systemctl start serial-getty@ttyS0.service |
이렇게 한 후에 KVM 시스템에서 console 접속을 하면 접속이 잘된다.
1 2 3 4 5 |
$ virsh console ubuntu20.04 Connected to domain ubuntu20.04 Escape character is ^] systemv login: |
이 방법은 18.04 에서도 가능하다.
Kubernetes 설치
Kubernetes 설치에 대해서 다룬다. 이번에는 Ubuntu 20.04 LTS, Centos 8.2 기반으로 진행했으며 이전에 설치에서 CNI 를 Calico 로 진행 했다. 더 나가 Helm, Metric Server 까지 진행 한다. 설치 환경은 다음과 같다. Master Distribution: Ubuntu 20.04 IP: 192.168.96.31 Hostname: kmaster account: systemv Worker Node Distribution: CentOS 8.2 IP: 192.168.96.32 Hostname: knode account: systemv CNI: Calico Helm 설치 Metric Server 설치 공통 설정 부분 Master, Node 두 서버 모두 Static IP 주소를 가지고 있어야 한다. 그리고 모두 일반 계정을 가지고 있어야 […]
VSCode 폰트 변경하기
VSCode 폰트(font) 변경하기에 대해서 알아본다. 환경도 윈도우즈가 아닌 리눅스(Linux) 에서 VSCode 폰트 변경이다. 리눅스 환경에서 폰트변경은 뭐든 쉬운 일이 아니다. 폰트(font) 알기 – fc-list 리눅스에서 폰트는 fc-list 명령어를 통해서 알 수 있다.
1 2 3 4 5 6 7 8 |
$ fc-list /usr/share/fonts/truetype/tlwg/TlwgTypo-Bold.ttf: Tlwg Typo:style=Bold /usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf: DejaVu Serif:style=Bold /usr/share/fonts/truetype/noto/NotoSansThai-Regular.ttf: Noto Sans Thai:style=Regular /usr/share/fonts/truetype/noto/NotoSansModi-Regular.ttf: Noto Sans Modi:style=Regular /usr/share/fonts/opentype/urw-base35/URWBookman-LightItalic.otf: URW Bookman:style=Light Italic /usr/share/fonts/truetype/fonts-kalapi/Kalapi.ttf: Kalapi:style=Regular /usr/share/fonts/truetype/fonts-gujr-extra/Rekha.ttf: Rekha:style=Medium |
결과를 보면 다음과 같은 정보를 보여준다. 설치된 폰트 파일(전체 경로 포함) 폰트 이름. 스타일. 스타일은 Regular, Bold, Italic 등이다. 옵션없이 실행하자 설치된 모든 폰트들을 보여준다. 이 명령어에는 필터 기능을 제공한다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
$ fc-list : lang=ko /usr/share/fonts/truetype/nanum/NanumSquareRoundB.ttf: 나눔스퀘어라운드,NanumSquareRound,NanumSquareRound Bold,나눔스퀘어라운드 Bold:style=Bold,Regular /usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK SC:style=Bold /usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK TC:style=Bold /usr/share/fonts/opentype/noto/NotoSansCJK-Black.ttc: Noto Sans CJK HK,Noto Sans CJK HK Black:style=Black,Regular /usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK JP:style=Bold /usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK KR:style=Bold /usr/share/fonts/truetype/nanum/NanumSquareRoundR.ttf: 나눔스퀘어라운드,NanumSquareRound,NanumSquareRound Regular,나눔스퀘어라운드 Regular:style=Regular /usr/share/fonts/truetype/nanum/NanumSquareB.ttf: 나눔스퀘어,NanumSquare,NanumSquare Bold,나눔스퀘어 Bold:style=Bold /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK JP:style=Regular /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK HK:style=Regular /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK KR:style=Regular /usr/share/fonts/opentype/noto/NotoSansCJK-Black.ttc: Noto Sans CJK TC,Noto Sans CJK TC Black:style=Black,Regular /usr/share/fonts/opentype/noto/NotoSerifCJK-Medium.ttc: Noto Serif CJK KR,Noto Serif CJK KR Medium:style=Medium,Regular /usr/share/fonts/opentype/noto/NotoSansCJK-Black.ttc: Noto Sans CJK KR,Noto Sans CJK KR Black:style=Black,Regular /usr/share/fonts/truetype/wqy/wqy-microhei.ttc: WenQuanYi Micro Hei,文泉驛微米黑,文泉驿微米黑:style=Regular /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK SC:style=Regular |
‘:’ 를 기준으로 필터를 줄 수 있다. 필터는 ‘:’ 를 기준으로 연달아 적어주면 되는데 위의 예제는 […]
Oracle Linux 8 UEK 커널 설치
Oracle Linux 는 UEK(Unbreakable Enterprise Kernel) 라고 해서 커널을 제공 한다. Oracle 은 이를통해 최신의 커널을 제공하고 자신들만의 퍼포먼스 패치를 더해서 고성능을 낼수 있도록 했다. Oracle Linux 8 에서 UEK 커널을 설치해 보자. Yum Repository 확인 Oracle Linux 8 에는 uek 를 위한 yum repository 가 추가되어 있다. 다음과 같이 확인이 가능하다.
1 2 3 4 5 6 |
yum repolist Failed to set locale, defaulting to C.UTF-8 repo id repo name ol8_UEKR6 Latest Unbreakable Enterprise Kernel Release 6 for Oracle Linux 8 (x86_64) ol8_appstream Oracle Linux 8 Application Stream (x86_64) ol8_baseos_latest Oracle Linux 8 BaseOS Latest (x86_64) |
‘ol8_UEKR6’ 가 uek 를 위한 저장소(repository) 이다. 이제 다음과 같이 어떤 버전의 uek 커널이 있는지 다음과 같이 체크해보자.
1 2 3 4 5 |
yum list kernel-uek Last metadata expiration check: 0:19:13 ago on Thu Jul 23 19:37:48 2020. Available Packages kernel-uek.x86_64 5.4.17-2011.3.2.1.el8uek ol8_UEKR6 kernel-uek.src 5.4.17-2011.4.4.el8uek ol8_baseos_latest |
현재 시점에서 5.4 버전의 uek 커널이 있음을 알 […]
Oracle Linux 8.2 설치
Oracle 에서 만들어서 배포하는 Oracle Linux 8.2 를 설치해 본다. 현 시점(2020.07) 에서 최신버전은 Oracle Linux 8.2 이다. 다운로드 Oracle Linux 를 설치를 위해 준비된 이미지는 두가지로 전체 패키지를 담은 DVD 이미지와 Boot 이미지를 제공한다. Boot 이미지는 또 일반 커널과 UEK 커널을 가지는 버전으로 제공한다. 어느걸 하던 상관은 없다.
1 2 3 4 5 6 7 8 9 10 11 |
]# wget https://yum.oracle.com/ISOS/OracleLinux/OL8/u2/x86_64/x86_64-boot-uek.iso --2020-07-23 16:53:15-- https://yum.oracle.com/ISOS/OracleLinux/OL8/u2/x86_64/x86_64-boot-uek.iso Resolving yum.oracle.com (yum.oracle.com)... 104.75.8.194 접속 yum.oracle.com (yum.oracle.com)|104.75.8.194|:443... 접속됨. HTTP request sent, awaiting response... 200 OK Length: 682622976 (651M) [application/octet-stream] Saving to: ‘x86_64-boot-uek.iso’ x86_64-boot-uek.iso 100%[===============================================================>] 651.00M 11.7MB/s in 57s 2020-07-23 16:54:13 (11.3 MB/s) - ‘x86_64-boot-uek.iso’ saved [682622976/682622976] |
설치 다운받은 이미지를 USB 나 CD 로 구워서 부팅을 한다. 부팅을 하면 위와 같은 화면이 나온다. 여기서 “Install Oracle Linux 8.2.0” 를 선택해서 설치를 진행한다. 설치는 CentOS 설치 화면과 동일하다. […]
Spring5 Security 기초 템플릿 – Session
이 글은 Spring5 에 Spring-Security 에 대한 기초 템플릿이다. Session 유지를 위해서 Redis 를 필요로 한다. 또, ElasticSearch 의 RestHighLevelClient 로 ElasticSearch를 연결 한다. 데이터베이스는 JNDI 설정으로 연결 된다. 다음과 같은 내용을 담았다. JDK 11 Tomcat 서버 9 를 이용. spring-session.xml 을 작성해 Redis 를 세션으로 사용하도록 했다. JNDI 를 이용해 MySQL 에 연결된다. Redis 설정한 이유는 Spring Security 에 인증을 InMemory 를 요구 한다. 이는 다음과 같은 설정 때문이다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<authentication-manager> <authentication-provider> <user-service> <!-- This is required a InMemory DB. So I setup Redis and config to a spring-session.xml for connecting the redis if you set spring-session.xml, you should config also web.xml for springSessionRepositoryFilter --> <user name="jimi" password="{bcrypt}$2a$10$ddEWZUl8aU0GdZPPpy7wbu82dvEw/pBpbRvDQRqA41y6mK1CoH00m" authorities="ROLE_USER, ROLE_ADMIN" /> <user name="bob" password="{bcrypt}$2a$10$/elFpMBnAYYig6KRR5bvOOYeZr1ie1hSogJryg9qDlhza4oCw1Qka" authorities="ROLE_USER" /> <!-- Password is prefixed with {noop} to indicate to DelegatingPasswordEncoder that NoOpPasswordEncoder should be used. This is not safe for production, but makes reading in samples easier. Normally passwords should be hashed using BCrypt --> <!-- <user name="jimi" password="{noop}jimispassword" authorities="ROLE_USER, ROLE_ADMIN" /> --> <!-- <user name="bob" password="{noop}bobspassword" authorities="ROLE_USER" /> --> </user-service> </authentication-provider> </authentication-manager> |
인증을 위한 패스워드가 {bcrypt} 로 되어 있다. 이 설정은 […]