helm을 통해 kubernetes jenkins을 설치할 때. 주의해야 할 점이 있다.

 

 

 

jenkins 잡이 실행, 에러 정보가 모두 pods로 쌓인다. (Completed|Error)

 

 

처음에는 대수롭게 생각하지 않았는데. 이게 싸이면 결국 kubernetes 클러스터는 자원 부족으로 문제가 발생한다.

 

그래서 아래와 같은 커맨드로 종료하거나..

 

 

kubectl delete pod $(kubectl get pods | grep -E "Completed|Error" | awk '{print $1}') —force —grace-period=0

 

 

kubernetes job 등록해서.. 삭제하도록 해야 한다.

 

spec:
schedule: "*/30 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: kubectl-runner
image: wernight/kubectl
command: ["sh", "-c", "kubectl get jobs | awk '$4 ~ /[2-9]d$/ || $3 ~ 1' | awk '{print $1}' | xargs kubectl delete job"]
restartPolicy: Never

 

 

Posted by '김용환'
,

git 저장소를 옮길 때 branch, commit 모두 옮기는 방법이다. 

 

1.  다운 받고 싶은 git 저장소를 얻는다. (git 디렉토리를 보면 일반적으로 git clone한 것과 다르다. git의 메타 데이터를 읽는다)

$ git clone --bare https://github.com/knight76/ansiblebook

$ cd ansiblebook.git

$ ls -al

drwxr-xr-x  11 samuel.kim  staff  352 Jun 23 18:20 .
drwxr-xr-x  28 samuel.kim  staff  896 Jun 23 18:20 ..
-rw-r--r--   1 samuel.kim  staff   23 Jun 23 18:20 HEAD
drwxr-xr-x   2 samuel.kim  staff   64 Jun 23 18:20 branches
-rw-r--r--   1 samuel.kim  staff  176 Jun 23 18:20 config
-rw-r--r--   1 samuel.kim  staff   73 Jun 23 18:20 description
drwxr-xr-x  13 samuel.kim  staff  416 Jun 23 18:20 hooks
drwxr-xr-x   3 samuel.kim  staff   96 Jun 23 18:20 info
drwxr-xr-x   4 samuel.kim  staff  128 Jun 23 18:20 objects
-rw-r--r--   1 samuel.kim  staff  479 Jun 23 18:20 packed-refs
drwxr-xr-x   4 samuel.kim  staff  128 Jun 23 18:20 refs

 

 

2.  Organization와 저장소를 생성한다.

 

 

3. bare clone 한 디렉토리에서 새로 생성한 저장소에 mirror push를 수행 한다 

git push --mirror https://github.com/knight76/new_ansiblebook.git

 

Posted by '김용환'
,