1 maser
3 worker
1 ingress
# k8s couchbase 설치 참고
# https://kubernetes.io/blog/2016/08/create-couchbase-cluster-using-kubernetes/
# couchbase-cluster-master.yaml 내용
apiVersion: v1
kind: ReplicationController
metadata:
name: couchbase-master-rc
spec:
replicas: 1
selector:
app: couchbase-master-pod
template:
metadata:
labels:
app: couchbase-master-pod
spec:
containers:
- name: couchbase-master
image: couchbase:community-6.0.0
env:
- name: TYPE
value: MASTER
ports:
- containerPort: 8091
---
apiVersion: v1
kind: Service
metadata:
name: couchbase-master-service
labels:
app: couchbase-master-service
spec:
ports:
- port: 8091
selector:
app: couchbase-master-pod
# type: LoadBalancer
# couchbase-cluster-worker.yaml 내용
apiVersion: v1
kind: ReplicationController
metadata:
name: couchbase-worker-rc
spec:
replicas: 3
selector:
app: couchbase-worker-pod
template:
metadata:
labels:
app: couchbase-worker-pod
spec:
containers:
- name: couchbase-worker
image: couchbase:community-6.0.0
env:
- name: TYPE
value: "WORKER"
- name: COUCHBASE_MASTER
value: "couchbase-master-service"
- name: AUTO_REBALANCE
value: "false"
ports:
- containerPort: 8091
# couchbase-cluster-ingress.yaml 내용
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: couchbase-ingress
namespace: default
annotations:
ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: ysoftman-couchbase-server
http:
paths:
- path: /
backend:
serviceName: couchbase-master-service
servicePort: 8091
# couchbase 클러스터 master, worker, service, ingress 생성
kubectl apply -f couchbase-cluster-master.yaml
kubectl apply -f couchbase-cluster-worker.yaml
kubectl apply -f couchbase-cluster-ingress.yaml
# service, pod 확인
kubectl get all
# ingress 확인
kubectl get ingress
# ysoftman-couchbase-server 도메인을 만들면 ingress에서 처리해
# 외부에서 접속 할 수 있다.
http://ysoftman-couchbase-server
# worker pod 들의 ip 를 파악해서
kubectl get pod -o wide
# couchbase admin 페이지에서 서버 ip 를 추가한다.
http://ysoftman-couchbase-server -> servers -> add server 로 추가 -> rebalance
comments:
댓글 쓰기