CI-CD구축

[CI-CD구축] 3. Bitbucket 설치

SY정보 2025. 8. 3. 16:38

CI-CD구축을 위해 소스코드 관리도구가 필요합니다.

여기서는 Atlassian에서 개발한 Bitbucket을 사용하겠습니다.

Bitbucket은 주로 개발자들이 Git 또는 Mercurial 저장소를 관리하고 협업할 수 있게 도와주는 플랫폼입니다.

준비.도메인주소 등록

설치된 bitbucket 을 접근하기 위한 도메인주소를 정하고, 가비아 사이트에가서 등록합니다.

bitb.sytech.store 로 등록하겠습니다.

 

준비. 네임스페이스 생성

bitbucket이 설치될 namespace를 마련합니다.

PS C:\Users\ky945\sytech.store.ssl> k create namespace syns-bitb
namespace/syns-bitb created

PS C:\Users\ky945\sytech.store.ssl> k get namespace -A
NAME              STATUS   AGE
default           Active   33h
kube-node-lease   Active   33h
kube-public       Active   33h
kube-system       Active   33h
syns-bitb         Active   2s   # <---- 생성되었습니다.
syns-ingress      Active   32h
syns-nginx        Active   32h

PS C:\Users\ky945\sytech.store.ssl>

 

준비. 시크릿 생성

bitb.sytech.store 도메인으로 https 접속을 위해 인증서 값을 secret 으로 생성합니다.

*.sytech.store 도메인에 공인인증서가 있는 로컬PC 디렉토리 위치로 이동합니다.

다음 명령어를 실행합니다.

PS C:\Users\ky945> cd sytech.store.ssl

PS C:\Users\ky945\sytech.store.ssl> ls

    Directory: C:\Users\ky945\sytech.store.ssl

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---        2025-04-04  오후 8:33           2036 sytech.store.crt
-a---        2025-04-04  오후 8:33           2494 sytech.store.key
-a---        2025-04-04  오후 8:33           3866 sytech.store.pem
# crt 와 key 파일이 있어야 합니다.

PS C:\Users\ky945\sytech.store.ssl> k create secret tls sy-bitb-tls `
--cert=sytech.store.crt `
--key=sytech.store.key `
-n syns-bitb
secret/sy-bitb-tls created   # 생성이 성공하였습니다.

PS C:\Users\ky945\sytech.store.ssl> k get secret -n syns-bitb
NAME          TYPE                DATA   AGE
sy-bitb-tls   kubernetes.io/tls   2      7m11s

# syns-bitb 네임스페이스에 secret이 생성되었습니다.

 

추가로 secret 하나더 생성합니다.

이후에 bitbucket 과 Bamboo 간에 Application link 생성시 서로에 도메인 인증서가 등록되야합니다.

저는 와일드카드 인증서라서 그대로 사용하겠습니다.

주의! key 파일이 담기지않게 생성해야합니다. 그렇지않으면 pod 기동시 keytool 명령어에서 인증서 에러가 납니다.

PS C:\Users\ky945\sytech.store.ssl> k create secret generic sy-bitb-fullcrt `
--from-file=sytech.store.pem -n syns-bitb
# TLS타입이 아닌 generic 타입으로 생성합니다. key파일까지 들어가면 안됩니다.
# chain인증서까지 있는 pem파일로 생성했습니다. sytech.store.crt 이파일도 될지는 테스트 못해봤습니다.

PS C:\Users\ky945\sytech.store.ssl> k get secret -n syns-bitb
NAME                            TYPE                 DATA   AGE
sy-bitb-fullcrt                 Opaque               1      11s
sy-bitb-tls                     kubernetes.io/tls    2      10d
# 생성된거를 확인합니다.

 

준비. 영구스토리지 생성

간단하게 설치하고 테스트하기위한 목적이므로 StorageClass는 hostpath를 사용합니다.

PV 와 PVC 생성 yaml 파일을 만듭니다.

PS C:\Users\ky945> cd SYk8s
PS C:\Users\ky945\SYk8s> notepad sy-bitb-pv-pvc.yaml

apiVersion: v1
kind: PersistentVolume
metadata:
  name: sy-bitb-pv
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  storageClassName: hostpath
  persistentVolumeReclaimPolicy: Retain
  hostPath:
    path: "/run/desktop/mnt/host/c/Users/ky945/SYbitb/data"
# 로컬PC에 C:\Users\ky945\SYbitb\data 를 미리생성해야 합니다.
# /run/desktop/mnt/host/ 뒤에 로컬PC 경로를 붙이는 방법으로 path를 입력합니다.
    type: DirectoryOrCreate
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: sy-bitb-pvc
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: hostpath
  resources:
    requests:
      storage: 10Gi
      
PS C:\Users\ky945\SYk8s> k apply -f sy-bitb-pv-pvc.yaml -n syns-bitb
persistentvolume/sy-bitb-pv created
persistentvolumeclaim/sy-bitb-pvc created
# pvc는 syns-bitb 네임스페이스에 생성이 됩니다.

 

repository 추가

모든준비가 끝났으면 bitbucket에 repository를 추가하고, update를 합니다.

(주의! 먼저 helm이 설치되어 있어야합니다. 설치방법은 이전글에서 확인가능합니다)

PS C:\Users\ky945\SYk8s> helm repo add syrepo-bitbucket https://atlassian.github.io/data-center-helm-charts
"syrepo-bitbucket" has been added to your repositories

PS C:\Users\ky945\SYk8s> helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "syrepo-ingress-nginx" chart repository
...Successfully got an update from the "syrepo-bitbucket" chart repository
...Successfully got an update from the "syrepo-bitnami" chart repository
Update Complete. ⎈Happy Helming!⎈

 

설정값 적용

설처전에 ingress 와 영구스토리지에 대한 설정을 적용해야합니다.

bitbucket에 values을 가져옵니다.

PS C:\Users\ky945\SYk8s> helm show values syrepo-bitbucket/bitbucket > bitbucket-values.yaml

PS C:\Users\ky945\SYk8s> ls

    Directory: C:\Users\ky945\SYk8s

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---        2025-04-12  오전 6:07            525 sy-bitb-pv-pvc.yaml
-a---        2025-04-12  오전 6:27          57792 bitbucket-values.yaml

 

bitbucket-values.yaml 파일을 열어서 다음값을 설정합니다.

PS C:\Users\ky945\SYk8s> notepad bitbucket-values.yaml

# 211라인 volumes 내용이 있습니다.
# 값들을 찾아서 변경합니다.
volumes:
  localHome:
    persistentVolumeClaim:
      create: false              # 자동생성되는것을 취소합니다. 기본값.
    customVolume:                # {} 이부분 삭제하세요
      persistentVolumeClaim:
        claimName: sy-bitb-pvc   # 사전에 생성한 pvc를 지정합니다.
  
# 434라인부터 ingress 내용이 있습니다.
# 값들을 찾아서 변경합니다.
ingress:
  create: true                   # ingress를 생성합니다.
  className: "nginx"             # ingress contoller는 nginx 사용합니다. 기본값.
  nginx: true                    
  host: bitb.sytech.store        # bitbucket 접속 주소
  path: /                         
  tlsSecretName: sy-bitb-tls     # https 통신을 위한 TLS secret을 지정합니다.
  
# 1267라인에 secretName 내용이 있습니다.
bitbucket:
  additionalCertificates:        # 1158라인에 있는거와 혼동하시면 안됩니다.
    secretName: sy-bitb-fullcrt  # 추후 bamboo 와 bitbucket 간에 Application link 생성을 위해 필요합니다.

주의! secretName 값이 2곳에 있습니다. bitbucket -> mesh -> additionalCertificates -> secretName: 여기 아닙니다.

 

설치실행

PS C:\Users\ky945\SYk8s> helm install sy-bitb syrepo-bitbucket/bitbucket `
>> --namespace syns-bitb `            # bitbucket 네임스페이스에 설치합니다.
>> --set fullnameOverride=sybitb `    # 이름이 길게 나오지않게 지정합니다.
>> -f bitbucket-values.yaml           # 설정한 값으로 적용합니다.
NAME: sy-bitb
LAST DEPLOYED: Sat Apr 12 08:01:19 2025
NAMESPACE: syns-bitb
STATUS: deployed
REVISION: 1
NOTES:
Thank you for installing Bitbucket.

Your release is named sy-bitb, and resides in namespace syns-bitb.

Please run sanity tests against the release to verify it's healthy:

  $ helm test sy-bitb -n syns-bitb

If the Kubernetes resources in the release are still starting up, then the tests may fail, so it
is advisable to wait for the tests to pass before continuing.

To see the custom values you used for this release:

  $ helm get values sy-bitb -n syns-bitb

Bitbucket service URL: https://bitb.sytech.store/



For further documentation, see https://atlassian.github.io/data-center-helm-charts/

# 위 내용으로 나오면 설치는 성공입니다.

 

접속확인

https://bitb.sytech.store 접속합니다. 아래 내용으로 보이면 성공입니다.

Language는 English, Database는 internal로 선택하고 Next를 클릭합니다.

운영환경에서는 별도에 Databse를 사용하라고 합니다.

 

Licensing and settings

- Application title : SYBitbucket 입력

- License key : I need an evaluation license 선택

Generate license

- I have an account  선택 (계정이 없는분은 Create an account 선택합니다.)

 

로그인하면 다음 페이지가 보여집니다.

- 조직 : SYcompany 입력합니다.

- 인스턴스는 "아직 설치되지 않음" 선택합니다.

- "라이선스 생성" 클릭합니다.

 

확인 클릭

 

다시 원래화면으로 돌아왔습니다.

License key 값이 자동으로 들어가 있습니다. Next 클릭.

 

오류메시지가 나옵니다. 

무시하시고 "Retry Operation" 클릭합니다.

관리자 정보를 입력합니다.

"Go to Bitbucket"을 클릭합니다.

 

앞에서 입력한 Username 과 Password 입력후 "Log in" 클릭합니다.

 

아래 화면이 나오면 설치는 성공입니다.

 

'CI-CD구축' 카테고리의 다른 글

[CI-CD구축] 5. 최종 테스트  (2) 2025.08.03
[CI-CD구축] 4. Bamboo 설치  (2) 2025.08.03
[CI-CD구축] 2. Helm 설치  (0) 2025.08.03
[CI-CD구축] 1. Let's Encrypt 공인인증서 만들기  (0) 2025.08.03