<p>Hi just started using Kubernetes. I have deployed my flask application on Kubernetes with minkikube. I have running the MySQL server on my local machine. When I try to access the DB I will get error</p>
<pre><code> InternalError: (pymysql.err.InternalError) (1130, u&quot;Host '157.37.85.26' 
 is not allowed to connect to this MySQL server&quot;)
(Background on this error at: http://sqlalche.me/e/2j85)
</code></pre>
<p>the IP is dynamic here, every time I try to access..it will use different IP to connect</p>
<p>Here is my deployment.ymal file</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: flask-deployment
spec:
  selector:
    matchLabels:
      app: flask-crud-app
  replicas: 3
  template:
    metadata:
      labels:
        app: flask-crud-app
    spec:
      containers:
      - name: flask-crud-app
        image: flask-crud-app:latest
        ports:
        - containerPort: 80
</code></pre>
<p>And service.yaml</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: flask-service
spec:
  selector:
    app: flask-crud-app
  ports:
  - protocol: TCP
    port: 80
    targetPort: 80
    nodePort: 31000
  type: NodePort
</code></pre>

Vivek Singh Rathore
<p>It because your current configuration doesn't allow requests coming from that IP address. Say, you're connecting as <code>root</code> user, then a workaround will be(<strong>not recommended</strong>), giving <code>root</code> user the privilege to connect from that IP.</p>
<p>Connect to your mysql server and perform:</p>
<pre class="lang-sh prettyprint-override"><code>$ mysql -u root -p
$ GRANT ALL PRIVILEGES ON *.* TO 'root'@'my_ip' IDENTIFIED BY 'root_password' WITH GRANT OPTION;
$ FLUSH PRIVILEGES;
</code></pre>
<p><strong>Recommendation:</strong> Set up a new user with limited privileges and allow requests from the given IP for that user.</p>
