question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use & connect mysql client on kubernetes?

See original GitHub issue

How to use & connect mysql client ?

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    app: doccano
  name: doccano
  namespace: default
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: doccano
      tier: frontend
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: doccano
        tier: frontend
    spec:
      containers:
      - env:
        - name: ADMIN_USERNAME
          value: admin
        - name: ADMIN_EMAIL
          value: harsh.manvar@xxxx.com
        - name: ADMIN_PASSWORD
          value: admin
        - name: DATABASE_URL
          value: mysql://root:vbvf2lnhxxx@192.168.2.6:3306/doccano
        image: doccano/doccano
        imagePullPolicy: Always
        name: doccano
        ports:
        - containerPort: 8000
          name: http
          protocol: TCP
        - containerPort: 80
          name: https
          protocol: TCP
        resources:
          limits:
            cpu: 200m
            memory: 250Mi
          requests:
            cpu: 150m
            memory: 128Mi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30

error i am getting:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 15, in <module>
    import MySQLdb as Database
  File "/usr/local/lib/python3.6/site-packages/MySQLdb/__init__.py", line 18, in <module>
    from . import _mysql
ImportError: libmariadbclient.so.18: cannot open shared object file: No such file or directory

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "app/manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 357, in execute
    django.setup()
  File "/usr/local/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.6/site-packages/django/apps/registry.py", line 112, in populate
    app_config.import_models()
  File "/usr/local/lib/python3.6/site-packages/django/apps/config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/local/lib/python3.6/site-packages/django/contrib/auth/models.py", line 2, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "/usr/local/lib/python3.6/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
    class AbstractBaseUser(models.Model):
  File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 101, in __new__
    new_class.add_to_class('_meta', Options(meta, app_label))
  File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 305, in add_to_class
    value.contribute_to_class(cls, name)
  File "/usr/local/lib/python3.6/site-packages/django/db/models/options.py", line 203, in contribute_to_class
    self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
  File "/usr/local/lib/python3.6/site-packages/django/db/__init__.py", line 33, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "/usr/local/lib/python3.6/site-packages/django/db/utils.py", line 202, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/usr/local/lib/python3.6/site-packages/django/db/utils.py", line 110, in load_backend
    return import_module('%s.base' % backend_name)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 20, in <module>
    ) from err
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?

Environment

Trying to setup on Kubernetes.

For persistence data i have to add volume ? if i also have to add volume then mount path documentation?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
icoxfog417commented, May 11, 2020

@harshmanvar Thank you for sharing your knowledge! We don’t support MySQL officially now so we have to support it before deploying by Kubernetes.

1reaction
harshmanvarcommented, May 11, 2020

@icoxfog417 i am still struggling with persistence data issue #648 , however instead of MySQL i have updated config with postgresql and it’s working fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

mysql-client in Kubernetes to test your ... - Github-Gist
mysql -client in Kubernetes to test your connection to mysql server. kubectl run mysql-client --image=mysql:5.7 -it --rm --restart=Never -- /bin/bash.
Read more >
How to connect MySQL running on Kubernetes - Stack Overflow
Try the kubectl port-forward command. See The documentation for all available options. You'll have to use the MySQL client on your local ...
Read more >
How to Connect to a non-public MySQL Instance ... - Medium
A best practice to connect to a MySQL instance from a container is by utilizing the Secrets which you use in the same...
Read more >
4.1 Connect with MySQL Shell
Create a new container with MySQL Shell to administer a MySQL InnoDB Cluster. This is the preferred method, although every MySQL Operator for...
Read more >
Run a Single-Instance Stateful Application | Kubernetes
This command creates a new Pod in the cluster running a MySQL client and connects it to the server through the Service. If...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found