![]()
We can add this as part of a Docker image and a container running in a POD. How do we run this script as part of the Kubernetes cluster?Ī. ![]() Python script to connect to the DB import sqlalchemy as db engine = connection = nnect() metadata = db.MetaData(bind=connection, reflect=True) print(metadata)Ģ. POSTGRES APP NOT SHOWING DATABASES PASSWORDUsername => postgres Password => $POSTGRES_PASSWORD variable as found previosuly DB name => postgres Let’s use a simple python script connect_db.pyto connect to the DB. Looks like we can insert and query from the DB postgres=# CREATE TABLE phonebook(phone VARCHAR(32), firstname VARCHAR(32), lastname VARCHAR(32), address VARCHAR(64)) CREATE TABLE postgres=# INSERT INTO phonebook(phone, firstname, lastname, address) VALUES('+1 1', 'John', 'Doe', 'North America') INSERT 0 1 postgres=# SELECT * FROM phonebook ORDER BY lastname phone | firstname | lastname | address -+-+-+- +1 1 | John | Doe | North America (1 row) Add a cronjob which can connect to the DB every minute Validate if helm is installed correctly Let's try K8 : helm version version.BuildInfo" | base64 -decode) Let's try K8 : kubectl run postgres-postgresql-client -rm -tty -i -restart='Never' -namespace default -image docker.io/bitnami/postgresql:11.9.0-debian-10-r48 -env="PGPASSWORD=$POSTGRES_PASSWORD" -command - psql -host postgres-postgresql -U postgres -d postgres -p 5432 Let's try K8 : minikube status minikube type: Control Plane host: Running kubelet: Running apiserver: Running kubeconfig: ConfiguredĢ.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |