kubernetes-mysqli_real_connect():(HY000 / 1045):拒绝用户访问

时间:2019-05-29 17:11:05

标签: deployment kubernetes phpmyadmin

我正在尝试通过服务将phpmyadmin pod连接到mysql pod。

我的环境参数如下。当我把IP地址改为“ mysql-service”与mysql的连接时。但是,IP地址在重新启动Pod之后始终会更改。我正在尝试通过服务

连接phpmyadmin pod
kubectl get svc
NAME            TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
kubernetes      ClusterIP   10.96.0.1       <none>        443/TCP        27h
mysql-service   ClusterIP   None            <none>        3306/TCP       24h
nginx-service   NodePort    10.105.70.173   <none>        80:32444/TCP   23h
php             ClusterIP   10.110.61.200   <none>        9000/TCP       23h
phpmyadmin      NodePort    10.111.20.32    <none>        80:32443/TCP   23h


kubectl get pods
NAME                          READY   STATUS    RESTARTS   AGE
mysql-549669d6c6-xgjbc        1/1     Running   0          24h
nginx-5b948cd64b-8fbg4        1/1     Running   5          23h
nginx-5b948cd64b-gkx9w        1/1     Running   5          23h
nginx-5b948cd64b-tcchc        1/1     Running   5          23h
php-79b844588c-l8l7z          1/1     Running   0          23h
phpmyadmin-5577d5678c-vrtgg   1/1     Running   0          163m


         env:
#        - name: PMA_HOST
#          value: "172.17.0.30" #<<<--- mysql container IP
        - name: PMA_USER
          value: "root"
        - name: PMA_PASSWORD
          value: "password"
        - name: PMA_HOST
          value: "mysql-service" #<<<---- mysql service
        - name: PMA_PORT
          value: "3306"

请帮助我,请通过服务而非IP连接phpmyadmin。

0 个答案:

没有答案