반응형
- 네임스페이스 생성
kubectl create ns postgres
- Deployment 생성
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
namespace: postgres
spec:
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres:15.7-alpine
ports:
- containerPort: 5432
env:
- name: POSTGRES_DB
value: registry
- name: POSTGRES_USER
value: postgres
- name: POSTGRES_PASSWORD
value: mypassword
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: postgres-storage
volumes:
- name: postgres-storage
persistentVolumeClaim:
claimName: postgres-data-pvc
- 서비스 생성
apiVersion: v1
kind: Service
metadata:
name: postgres-svc
namespace: postgres
spec:
selector:
app: postgres
ports:
- protocol: TCP
port: 5432
targetPort: 5432
# pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: postgres-data-pv
namespace: postgres
spec:
capacity:
storage: 50Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data/postgres-data"
---
# pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgres-data-pvc
namespace: postgres
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Gi
- DB툴로 생성
##계정 생성
CREATE USER harbor WITH ENCRYPTED PASSWORD 'harbor12345!';
GRANT ALL PRIVILEGES ON DATABASE registry TO harbor;
##권한 부여
GRANT ALL ON ALL TABLES IN SCHEMA public TO harbor;
GRANT ALL ON ALL SEQUENCES IN SCHEMA public TO harbor;
- Helm Yaml 수정
- Helm YAML harbor 수정
- 기존 YAML 정보
- internal 정보 삭제
- External 정보 수정
database:
# if external database is used, set "type" to "external"
# and fill the connection information in "external" section
type: external
external:
host: "192.168.20.117"
port: "30491"
username: "harbor"
password: "harbor12345!"
coreDatabase: "registry"
helm upgrade my-release -n harbor -f values.yaml .
- Harbor 데이터베이스. internal 타입일 경우 database Pod로 동작
- 데이터베이스 external 으로 변경할 경우
- User생성
- Project 생성
반응형
'Harbor' 카테고리의 다른 글
Harbor 스캔 적용(Trivy) (0) | 2024.11.20 |
---|---|
Harbor 설치 (0) | 2024.11.20 |
Harbor Replicas 설정 (0) | 2024.06.28 |
Harbor HA 구성 (0) | 2024.06.28 |
댓글