Notice
Recent Posts
Recent Comments
Link
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Tags
more
Archives
Today
Total
관리 메뉴

클라우드 엔지니어 꿈나무

Kubernetes 복수 Pods 로 wordpres + mysql 설치 - Centos7 본문

kubernetes

Kubernetes 복수 Pods 로 wordpres + mysql 설치 - Centos7

새싹싹이 2023. 9. 13. 20:56

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

mysql 접속 화면

exit

vi /etc/haproxy/haproxy.cfg
80포트 개방

인터넷 창

10.0.0.1 입력 시, 하기의 창 출력