클라우드 엔지니어 꿈나무
Kubernetes 복수 Pods 로 wordpres + mysql 설치 - Centos7 본문
vi mysql.yml
apiVersion: v1
kind: Pod
metadata:
name: mysql
labels:
app: mysql
spec:
containers:
- name: m1
image: mysql:5.6
imagePullPolicy: IfNotPresent
env:
- name: MYSQL_ROOT_PASSWORD
value: It12345!
- name: MYSQL_DATABASE
value: wordpress
- name: MYSQL_ROOT_HOST
value: "%"
ports:
- containerPort: 3306
nodeName: node3
kubectl apply -f mysql.yml
kubectl get pods -o wide
vi wordpress.yml
apiVersion: v1
kind: Pod
metadata:
name: word1
labels:
app: word1
spec:
containers:
- name: m1
image: wordpress:5.6
imagePullPolicy: Never
env:
- name: WORDPRESS_DB_HOST
value: 10.42.0.1
- name: WORDPRESS_DB_NAME
value: wordpress
- name: WORDPRESS_DB_USER
value: root
- name: WORDPRESS_DB_PASSWORD
value: It12345!
ports:
- containerPort: 80
nodeName: node1
kubectl apply -f wordpress.yml
kuectl get pods -o wide
mysql -uroot -pIt12345! -h 10.42.0.1
exit
vi /etc/haproxy/haproxy.cfg
80포트 개방
인터넷 창
10.0.0.1 입력 시, 하기의 창 출력
'kubernetes' 카테고리의 다른 글
Kubernetes(K8S) 설치 - Centos7 (0) | 2023.09.16 |
---|---|
Kubernetes(K8S) Storage: Empty Dir - Centos7 (0) | 2023.09.14 |
Kubernetes(K8S) pods 내 파일 복사 - Centos7 (0) | 2023.09.13 |
Kubernetes 단일 Pods 내 wordpress + mysql 설치 - Centos 7 (0) | 2023.09.13 |
Kubernetes(k8s) Deployments - Centos 7 (0) | 2023.09.13 |