2023/02 7

[stress] stress 사용법

개요 linux에서 부하 테스트를 하기위해서 대부분 stress라는 tool은 사용합니다. 이에 대하여 어떻게 사용하는지 알아보겠습니다. stress 옵션 Usage: stress [OPTION [ARG]] ... -?, --help show this help statement --version show version statement -v, --verbose be verbose -q, --quiet be quiet -n, --dry-run show what would have been done -t, --timeout N timeout after N seconds --backoff N wait factor of N microseconds before work starts -c, --cpu N spawn..

[swagger] swagger UI cors 해결

개요 beego + swagger를 사용하려고 할때 swagger 실행 서버랑 web brower 실행 ip가 다를때 cors오류가 발생 하는데 이를 해결하는 방법을 남깁니다. 현상 Fetch error Failed to fetch https://petstore.swagger.io/v2/swagger.json Fetch error Possible cross-origin (CORS) issue? The URL origin (https://petstore.swagger.io) does not match the page (http://1.1.1.1). Check the server returns the correct 'Access-Control-Allow-*' headers. 해결법 swagger 디렉토리 하..

[CKA] 9. Pod resource 제어 방법

개요 k8s에서 resource(CPU, Memory, HugePages, Ephemeral storage)를 제어하는 방법에 대하여 알아보겠습니다. 그중 특히 CPU에 대한 것을 집중 적으로 알아보겠습니다. k8s에서의 resource 분류 Compressible resources cpu Incompressible resources Memory, HugePages, Ephemeral storage Compressible vs Incompressible resources 두 분류의 구분 기준? "resource 사용을 제한했을 때 pcoress를 실행 할 수 있는가"로 구분합니다. CPU의 경우 resource 사용을 제한했을 때 pcoress를 실행 할 수 있습니다. Memory, HugePages, ..

Cloud/k8s-CKA 2023.02.14

[CKA] 8. schedule (Node Selector, Node Affinity)

개요Node Selector와 Node Affinity 기능에 대하여 알아보겠습니다. 용도두 기능의 용도는 Pod를 내가 원하는 Node에 배치하고 싶을 때 사용합니다. Node Selector동작 방식 특정 node에 Label을 설정 한 다음 node와 동일한 Label을 소유한 Pod만 특정 Node에 배치하는 것입니다.  다음 그림은 Node1에  size: Large라는 Label를 설정 후 size: Large를 가진 Pod만 Node1에 배포하는 그림입니다.Node에 Label 확인#kubectl get nodes --show-labels#kubectl get node worker1 --show-labelsNode에 Label 설정kubectl label node =label-value>#..

Cloud/k8s-CKA 2023.02.11

[코지] const 위치별 사용법

const 위치별 사용법 const의 기능은 상수화 하는 것입니다. 1. 일반 변수 일반 변수선언 시 const는 아래와 같이 2군데 위치에 올 수 있다. 이 경우 const의 위치에 따른 var에 대한 제약은 동일하 효과를 얻는다. 코딩할 때는 1번을 사용하자 1) const int var; 2) int const var; 2. pointer 변수 pointer 변수를 선언할 경우 아래와 같이 3군데에 const가 위치할 수 있다. 그런데 이렇게 되면 const의 상수화 범위가 너무 헷갈리수 있습니다. 그러나 const 원리만 알면 아래의 3가지는 쉽게 구분이 가능합니다. 원리는 const는 바로 뒤에 위치한 것만 상수화 합니다. 상수화 하는 부분은 보라색으로 표기하겠습니다. 1) const int* ..

[go] vscode Error 및 Warning

개요 vscode에서 코딩시 발생하는 오류들을 정리 합니다. (ST1017) Yoda conditions don't use Yoda conditions (ST1017) go-staticcheck https://knowthecode.io/yoda-conditions-yoda-not-yoda Yoda Conditions: To Yoda or Not to Yoda - Know the Code Tonya explains the Yoda conditions programming style. She discusses its intent and the problem it seeks to solve. A handy guide and litmus test are included to help you decide when..

ProgrammingLang/Go 2023.02.02

[CKA] 7. schedule (nodeName, taint, toleration)

개요k8s에서의 schedule 동작 방식과 scheduling 방법을 알아보겠습니다. https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/nodeName(manual scheduling)원리pod를 만들때 배포할 node를 선택하는 방식 입니다. 필수 필드 : nodeName: worker1nodeName을 지정하여 배포할 node를 선택 합니다.apiVersion: v1kind: Podmetadata: labels: run: schedule-nginx-1 name: schedule-nginx-1spec: containers: - image: nginx name: schedule-nginx-1 ports:..

Cloud/k8s-CKA 2023.02.02