인프런 커뮤니티 질문&답변

yuki님의 프로필 이미지
yuki

작성한 질문수

실리콘밸리 엔지니어에게 배우는 쿠버네티스 for SWE

Helm 명령어에 대해 자세히 알아보자

helm mysql 실습 도중 에러

작성

·

538

·

수정됨

1

 

helm 실습 도중 mysql이 정상적으로 실행이 되지 않는 것 같아 문의드립니다.

helm install mydb bitnami/mysql -f my-values.yaml
NAME: mydb
LAST DEPLOYED: Sun Jan 21 03:15:02 2024
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: mysql
CHART VERSION: 9.18.0
APP VERSION: 8.0.36

** Please be patient while the chart is being deployed **

Tip:

  Watch the deployment status using the command: kubectl get pods -w --namespace default

Services:

  echo Primary: mydb-mysql.default.svc.cluster.local:3306

Execute the following to get the administrator credentials:

  echo Username: root
  MYSQL_ROOT_PASSWORD=$(kubectl get secret --namespace default mydb-mysql -o jsonpath="{.data.mysql-root-password}" | base64 -d)

To connect to your database:

  1. Run a pod that you can use as a client:

      kubectl run mydb-mysql-client --rm --tty -i --restart='Never' --image  docker.io/bitnami/mysql:8.0.36-debian-11-r0 --namespace default --env MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD --command -- bash

  2. To connect to primary service (read/write):

      mysql -h mydb-mysql.default.svc.cluster.local -uroot -p"$MYSQL_ROOT_PASSWORD"

my-values.yaml을 이용해서 helm mysql을 띄우고 있습니다.

kctl get pods
NAME           READY   STATUS    RESTARTS   AGE
mydb-mysql-0   0/1     Running   0          35s

위의 Ready가 1로 바뀌지 않습니다.

아래와 같이 접속이 되지 않습니다

kubectl run mydb-mysql-client --rm --tty -i --restart='Never' --image  docker.io/bitnami/mysql:8.0.36-debian-11-r0 --namespace default --env MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD --command -- bash
If you don't see a command prompt, try pressing enter.
I have no name!@mydb-mysql-client:/$ 

# 실행이 되지 않는 부분
I have no name!@mydb-mysql-client:/$ mysql -h mydb-mysql.default.svc.cluster.local -uroot -p"$MYSQL_ROOT_PASSWORD"
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on 'mydb-mysql.default.svc.cluster.local:3306' (111)
I have no name!@mydb-mysql-client:/$ 

 

문제가 있는 pod의 로그를 남깁니다.

제가 조치해야할 부분에 대해 답변 해주시면 감사드리겠습니다.

kubectl logs mydb-mysql-0 -n default
mysql 18:16:54.38 INFO  ==> 
mysql 18:16:54.38 INFO  ==> Welcome to the Bitnami mysql container
mysql 18:16:54.38 INFO  ==> Subscribe to project updates by watching https://github.com/bitnami/containers
mysql 18:16:54.38 INFO  ==> Submit issues and feature requests at https://github.com/bitnami/containers/issues
mysql 18:16:54.38 INFO  ==> 
mysql 18:16:54.38 INFO  ==> ** Starting MySQL setup **
mysql 18:16:54.39 INFO  ==> Validating settings in MYSQL_*/MARIADB_* env vars
mysql 18:16:54.40 INFO  ==> Initializing mysql database
mysql 18:16:54.40 WARN  ==> The mysql configuration file '/opt/bitnami/mysql/conf/my.cnf' is not writable. Configurations based on environment variables will not be applied for this file.
mysql 18:16:54.40 INFO  ==> Using persisted data
mysql 18:16:54.42 INFO  ==> Running mysql_upgrade
mysql 18:16:54.42 INFO  ==> Starting mysql in background
2024-01-20T18:16:54.827769Z 0 [Warning] [MY-011068] [Server] The syntax 'skip_slave_start' is deprecated and will be removed in a future release. Please use skip_replica_start instead.
2024-01-20T18:16:54.827877Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2024-01-20T18:16:54.827893Z 0 [System] [MY-010116] [Server] /opt/bitnami/mysql/bin/mysqld (mysqld 8.0.36) starting as process 46
2024-01-20T18:16:54.833609Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2024-01-20T18:16:54.842169Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-01-20T18:16:55.006185Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-01-20T18:16:55.095907Z 4 [System] [MY-013381] [Server] Server upgrade from '80036' to '80036' started.
2024-01-20T18:16:57.163961Z 4 [System] [MY-013381] [Server] Server upgrade from '80036' to '80036' completed.
2024-01-20T18:16:57.288943Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2024-01-20T18:16:57.289454Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2024-01-20T18:16:57.304275Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock
2024-01-20T18:16:57.304353Z 0 [System] [MY-010931] [Server] /opt/bitnami/mysql/bin/mysqld: ready for connections. Version: '8.0.36'  socket: '/opt/bitnami/mysql/tmp/mysql.sock'  port: 3306  Source distribution.
find: '/docker-entrypoint-startdb.d/': No such file or directory
mysql 18:16:58.45 INFO  ==> Stopping mysql
2024-01-20T18:16:58.468953Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.36).
2024-01-20T18:17:00.619438Z 0 [System] [MY-010910] [Server] /opt/bitnami/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.36)  Source distribution.
mysql 18:17:01.54 INFO  ==> ** MySQL setup finished! **

mysql 18:17:01.58 INFO  ==> ** Starting MySQL **
2024-01-20T18:17:01.948065Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2024-01-20T18:17:01.948084Z 0 [System] [MY-010116] [Server] /opt/bitnami/mysql/bin/mysqld (mysqld 8.0.36) starting as process 1
2024-01-20T18:17:01.957828Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2024-01-20T18:17:01.968662Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-01-20T18:17:02.085467Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-01-20T18:17:02.232037Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2024-01-20T18:17:02.232066Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2024-01-20T18:17:02.245171Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock
2024-01-20T18:17:02.245200Z 0 [System] [MY-010931] [Server] /opt/bitnami/mysql/bin/mysqld: ready for connections. Version: '8.0.36'  socket: '/opt/bitnami/mysql/tmp/mysql.sock'  port: 3306  Source distribution.
2024-01-20T18:17:13.205722Z 8 [Warning] [MY-013360] [Server] Plugin mysql_native_password reported: ''mysql_native_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
2024-01-20T18:17:23.196807Z 9 [Warning] [MY-013360] [Server] Plugin mysql_native_password reported: ''mysql_native_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
2024-01-20T18:17:34.146016Z 10 [Warning] [MY-013360] [Server] Plugin mysql_native_password reported: ''mysql_native_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
2024-01-20T18:17:43.208718Z 11 [Warning] [MY-013360] [Server] Plugin mysql_native_password reported: ''mysql_native_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'

 

답변 1

0

미쿡엔지니어님의 프로필 이미지
미쿡엔지니어
지식공유자

안녕하세요 Daniel Ryu님,

일단 불편을 드려 죄송합니다. Helm Chart를 제가 관리하지 않다보니, 버전이 올라가면 안될 가능성이 있을 수 있겠네요.

제가 실습 당시 사용했던 버전은 아래와 같았습니다.

NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: mysql
CHART VERSION: 9.7.2
APP VERSION: 8.0.33

저도 다음 명령어를 사용해서 같은 버전을 사용해서 해봤는데 helm install mydb bitnami/mysql --version 9.18.0 -f my-values.yaml 아무런 문제는 찾지 못했습니다.

혹시 제가 사용했던 버전을 사용해 보시겠어요?

 

일단 helm uninstall mydb을 사용하셔서 기존에 설치한 부분을 릴리즈 하신 후에 제가 실습때 사용했던 helm install mydb bitnami/mysql --version 9.7.2 -f my-values.yaml를 사용해 보세요.

 

남겨주신 로그와 제 로컬과 비교했을때에도 별로 문제를 찾지는 못했습니다.

마지막으로 혹시 kubectl get service을 하셔서 혹시 다른 Pod이 방해를 하지는 않는지도 확인해 보셨으면 합니다.

마지막 방법으로는 minikube stop을 하신 후 재 시작하는 방법도 추천드립니다.

그래도 안되면 알려주세요. 다른 이슈가 있을 지 한 번 생각해 보겠습니다.

yuki님의 프로필 이미지
yuki

작성한 질문수

질문하기