{"id":3655,"date":"2023-07-26T10:43:22","date_gmt":"2023-07-26T07:43:22","guid":{"rendered":"https:\/\/www.virtono.com\/community\/?p=3655"},"modified":"2023-07-26T10:43:30","modified_gmt":"2023-07-26T07:43:30","slug":"how-to-deploy-postgresql-on-k3s","status":"publish","type":"post","link":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-postgresql-on-k3s\/","title":{"rendered":"How to Deploy PostgreSQL on K3s"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" data-attachment-id=\"3662\" data-permalink=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-postgresql-on-k3s\/attachment\/deploy-postgresql-on-k3s\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Deploy-PostgreSQL-on-K3s.png?fit=1920%2C1080&amp;ssl=1\" data-orig-size=\"1920,1080\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Deploy-PostgreSQL-on-K3s\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Deploy-PostgreSQL-on-K3s.png?fit=750%2C422&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Deploy-PostgreSQL-on-K3s.png?resize=750%2C422&#038;ssl=1\" alt=\"How to Deploy PostgreSQL on K3s\" class=\"wp-image-3662\" srcset=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Deploy-PostgreSQL-on-K3s.png?resize=1024%2C576&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Deploy-PostgreSQL-on-K3s.png?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Deploy-PostgreSQL-on-K3s.png?resize=768%2C432&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Deploy-PostgreSQL-on-K3s.png?resize=1536%2C864&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Deploy-PostgreSQL-on-K3s.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This guide will provide a detailed walkthrough on how to deploy PostgreSQL on K3s cluster. Everything will be covered, from the necessary steps to the deployment procedure, testing, and connection to the PostgreSQL database.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">K3s is a certified, lightweight Kubernetes distribution designed for the Internet of Things and edge computing. K3s, created by Rancher Labs, has grown in popularity as a result of its ease of use and low resource requirements, making it the ideal option for developers and businesses looking to deploy applications in environments with limited resources.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On the other hand, PostgreSQL is a powerful open-source object-relational database system. It has had more than 30 years of continuous development, and it has a solid track record for dependability, sturdiness, and performance.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_73 counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-postgresql-on-k3s\/#Prerequisites\" title=\"Prerequisites\">Prerequisites<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-postgresql-on-k3s\/#Step_1_Add_the_Bitnami_Helm_repository\" title=\"Step 1: Add the Bitnami Helm repository\">Step 1: Add the Bitnami Helm repository<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-postgresql-on-k3s\/#Step_2_Deploying_PostgreSQL_on_K3s\" title=\"Step 2: Deploying PostgreSQL on K3s\">Step 2: Deploying PostgreSQL on K3s<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-postgresql-on-k3s\/#Step_3_Verifying_the_Deployment\" title=\"Step 3: Verifying the Deployment\">Step 3: Verifying the Deployment<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-postgresql-on-k3s\/#Step_4_Connecting_to_PostgreSQL_on_K3s\" title=\"Step 4: Connecting to PostgreSQL on K3s\">Step 4: Connecting to PostgreSQL on K3s<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-postgresql-on-k3s\/#Final_Thoughts\" title=\"Final Thoughts\">Final Thoughts<\/a><\/li><\/ul><\/nav><\/div>\n<h3 class=\"wp-block-heading has-accent-color has-text-color\"><span class=\"ez-toc-section\" id=\"Prerequisites\"><\/span>Prerequisites<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Make sure you have the following prerequisites before we start the deployment process:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Knowledge of the fundamental Kubernetes concepts, such as Pods, Services, Deployments, and StatefulSets, is essential.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>K3s should already be installed and running on <a href=\"https:\/\/virtono.com\/cloud-vps\" target=\"_blank\" rel=\"noopener\">your machine<\/a>. You can learn <a href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-redis-on-kubernetes\/\">How to install K3s here<\/a>.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Installed Helm: <a href=\"https:\/\/helm.sh\/\" target=\"_blank\" rel=\"noopener\">Helm<\/a>, the Kubernetes package manager, makes it easier to deploy applications on the container-based platform. Installed on your system must be Helm 3.x. You can learn <a href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-redis-on-kubernetes\/\">here how to install Helm<\/a>.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>For this deployment, you&#8217;ll need to have access to a PostgreSQL Docker image. It is sufficient to use the official PostgreSQL image from Docker Hub.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading has-accent-color has-text-color\"><span class=\"ez-toc-section\" id=\"Step_1_Add_the_Bitnami_Helm_repository\"><\/span>Step 1: Add the Bitnami Helm repository<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You must add the Bitnami Helm repository to your Helm client after K3s and Helm have been installed. Pre-configured Helm charts are available from Bitnami for a variety of well-known open-source programs, including PostgreSQL. The Bitnami Helm repository can be added as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>helm repo add bitnami https:\/\/charts.bitnami.com\/bitnami<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To ensure that your Helm client has the most recent version of the charts, you should update it after adding the Bitnami Helm repository:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>helm repo update<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"706\" height=\"114\" data-attachment-id=\"3656\" data-permalink=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-postgresql-on-k3s\/attachment\/screenshot-2023-07-25-at-16-29-55\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.29.55.png?fit=706%2C114&amp;ssl=1\" data-orig-size=\"706,114\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot-2023-07-25-at-16.29.55\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.29.55.png?fit=706%2C114&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.29.55.png?resize=706%2C114&#038;ssl=1\" alt=\"How to Deploy PostgreSQL on K3s\" class=\"wp-image-3656\" srcset=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.29.55.png?w=706&amp;ssl=1 706w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.29.55.png?resize=300%2C48&amp;ssl=1 300w\" sizes=\"auto, (max-width: 706px) 100vw, 706px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading has-accent-color has-text-color\"><span class=\"ez-toc-section\" id=\"Step_2_Deploying_PostgreSQL_on_K3s\"><\/span>Step 2: Deploying PostgreSQL on K3s<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Now that Helm has been installed and the environment has been set up, PostgreSQL on K3s can be deployed. Running the following command accomplishes this:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>helm install my-postgresql bitnami\/postgresql<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"242\" data-attachment-id=\"3657\" data-permalink=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-postgresql-on-k3s\/attachment\/screenshot-2023-07-25-at-15-50-13\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-15.50.13.png?fit=1758%2C568&amp;ssl=1\" data-orig-size=\"1758,568\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot-2023-07-25-at-15.50.13\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-15.50.13.png?fit=750%2C242&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-15.50.13.png?resize=750%2C242&#038;ssl=1\" alt=\"Deploying PostgreSQL on K3s\" class=\"wp-image-3657\" srcset=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-15.50.13.png?resize=1024%2C331&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-15.50.13.png?resize=300%2C97&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-15.50.13.png?resize=768%2C248&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-15.50.13.png?resize=1536%2C496&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-15.50.13.png?w=1758&amp;ssl=1 1758w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This command uses the Bitnami PostgreSQL Helm chart to deploy PostgreSQL on K3s cluster. You can use any name you like for the my-postgresql argument, which is the name of the Helm release.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The command outputs some information about the deployment, including the PostgreSQL admin password. It&#8217;s important to note down this password as you&#8217;ll need it later to connect to the PostgreSQL database.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can also find the PostgreSQL password by following these steps:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You&#8217;ll need to decode the password since it is stored in base64 format. The encoded value isn&#8217;t directly disclosed by the kubectl describe secret command, though. The encrypted password can be retrieved by using the kubectl get secret command with the -o jsonpath option.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Get the Encoded Password<\/strong>: Use the following command to get the encoded password:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>kubectl get secret my-postgresql -o jsonpath=\"{.data.postgres-password}\"<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"74\" data-attachment-id=\"3658\" data-permalink=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-postgresql-on-k3s\/attachment\/screenshot-2023-07-25-at-16-36-33\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.36.33.png?fit=775%2C76&amp;ssl=1\" data-orig-size=\"775,76\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot-2023-07-25-at-16.36.33\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.36.33.png?fit=750%2C74&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.36.33.png?resize=750%2C74&#038;ssl=1\" alt=\"PostgreSQL on K3s\" class=\"wp-image-3658\" srcset=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.36.33.png?w=775&amp;ssl=1 775w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.36.33.png?resize=300%2C29&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.36.33.png?resize=768%2C75&amp;ssl=1 768w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This command will return the base64 encoded password.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Decode the Password<\/strong>: The password is stored in base64 format, so you&#8217;ll need to decode it. You can do this with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>echo '&lt;base64-password&gt;' | base64 --decode<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace&nbsp;<code>&lt;base64-password&gt;<\/code>&nbsp;with the base64-encoded password you got from the previous command.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"85\" data-attachment-id=\"3659\" data-permalink=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-postgresql-on-k3s\/attachment\/screenshot-2023-07-25-at-16-37-47\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.37.47.png?fit=754%2C85&amp;ssl=1\" data-orig-size=\"754,85\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot-2023-07-25-at-16.37.47\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.37.47.png?fit=750%2C85&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.37.47.png?resize=750%2C85&#038;ssl=1\" alt=\"find the PostgreSQL on k3s password\" class=\"wp-image-3659\" srcset=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.37.47.png?w=754&amp;ssl=1 754w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.37.47.png?resize=300%2C34&amp;ssl=1 300w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading has-accent-color has-text-color\"><span class=\"ez-toc-section\" id=\"Step_3_Verifying_the_Deployment\"><\/span>Step 3: Verifying the Deployment<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run the following command to see if PostgreSQL has been successfully deployed:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>kubectl get pods<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This command will list all the pods running in your K3s cluster. You should see a pod with a name that starts with my-postgresql.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The following command can be used to check the PostgreSQL service&#8217;s status:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>kubectl get svc my-postgresql<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The PostgreSQL service&#8217;s ClusterIP and port will be included in the output from this command. This data can be used to establish a connection to PostgreSQL.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-accent-color has-text-color\"><span class=\"ez-toc-section\" id=\"Step_4_Connecting_to_PostgreSQL_on_K3s\"><\/span>Step 4: Connecting to PostgreSQL on K3s<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To connect to PostgreSQL on K3s, you can use the&nbsp;<code>psql<\/code>&nbsp;command line utility. You can install it on your system using your package manager. For example, on Ubuntu, you can install it with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>sudo apt-get install postgresql-client<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Once you have&nbsp;<code>psql<\/code>&nbsp;installed, you can connect to PostgreSQL by running the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>PGPASSWORD=&lt;password&gt; psql --host &lt;ClusterIP&gt; --port &lt;port&gt; --username postgres --dbname postgres<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace&nbsp;<code>&lt;password&gt;<\/code>&nbsp;with the PostgreSQL admin password,&nbsp;<code>&lt;ClusterIP&gt;<\/code>&nbsp;with the ClusterIP of the PostgreSQL service, and&nbsp;<code>&lt;port&gt;<\/code>&nbsp;with the port of the PostgreSQL service.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"124\" data-attachment-id=\"3660\" data-permalink=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-postgresql-on-k3s\/attachment\/screenshot-2023-07-25-at-16-44-44\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.44.44.png?fit=1030%2C170&amp;ssl=1\" data-orig-size=\"1030,170\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot-2023-07-25-at-16.44.44\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.44.44.png?fit=750%2C124&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.44.44.png?resize=750%2C124&#038;ssl=1\" alt=\"Connecting to PostgreSQL on K3s\" class=\"wp-image-3660\" srcset=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.44.44.png?resize=1024%2C169&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.44.44.png?resize=300%2C50&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.44.44.png?resize=768%2C127&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-25-at-16.44.44.png?w=1030&amp;ssl=1 1030w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading has-accent-color has-text-color\"><span class=\"ez-toc-section\" id=\"Final_Thoughts\"><\/span>Final Thoughts<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you have the proper tools and knowledge, installing PostgreSQL on K3s is a simple process. Using the Bitnami PostgreSQL Helm chart, this guide has shown you how to set up your environment, install Helm, deploy PostgreSQL, check the deployment, and connect to PostgreSQL. With this information, you should&nbsp;be able to deploy PostgreSQL on K3s without difficulty, giving your applications a solid and dependable database solution.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This guide will provide a detailed walkthrough on how to deploy PostgreSQL on K3s cluster. Everything will be covered, from the necessary steps to the deployment procedure, testing, and connection to the PostgreSQL database. K3s is a certified, lightweight Kubernetes distribution designed for the Internet of Things and edge computing.<\/p>\n","protected":false},"author":8,"featured_media":3661,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[3],"tags":[565,563,560,562,564,566,552,567,561],"class_list":["post-3655","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorial-how-to","tag-connecting-to-postgresql","tag-create-postgresql-namespace","tag-deploy-postgresql","tag-deploying-postgresql-on-k3s","tag-deploying-postgresql-on-kubernetes","tag-how-to-deploy-postgresql","tag-installing-k3s","tag-postgresql-on-k3s","tag-postgresql-on-kubernetes"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/How-to-Deploy-PostgreSQL-on-K3s.png?fit=360%2C240&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7ISfL-WX","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":3665,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-postgres-high-availability-on-kubernetes\/","url_meta":{"origin":3655,"position":0},"title":"How to Deploy Postgres High Availability on Kubernetes","author":"George B.","date":"July 28, 2023","format":false,"excerpt":"We will cover the deployment of Postgres High Availability (HA) on K3s in great detail in this article. We'll go over the requirements, detailed instructions, and troubleshooting advice. You'll have a reliable, scalable, and highly available Postgres setup on your K3s cluster by the end of this guide. PostgreSQL, also\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Deploy-Postgres-HA-on-Kubernetes.png?fit=360%2C240&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3641,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-redis-on-kubernetes\/","url_meta":{"origin":3655,"position":1},"title":"How to Deploy Redis on Kubernetes","author":"George B.","date":"July 25, 2023","format":false,"excerpt":"This article provides a detailed guide on how to install Redis on Kubernetes, covering everything from configuring the Kubernetes environment to installing and administering Redis. The demand for effective, scalable, and trustworthy data storage solutions has increased as the world transitions to microservices and containerized applications. Redis, a high-performance in-memory\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/How-to-Deploy-Redis-on-Kubernetes.png?fit=360%2C240&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3695,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-prometheus-on-kubernetes\/","url_meta":{"origin":3655,"position":2},"title":"How to Deploy Prometheus on Kubernetes","author":"George B.","date":"July 30, 2023","format":false,"excerpt":"In this tutorial, we'll discuss how to set up Prometheus on Kubernetes. We'll assume that you've already installed Helm and K3s. If you don't have K3s and Helm installed you can follow our guide. Prometheus has established itself as a top open-source option for monitoring and alerting systems. It is\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/How-to-Deploy-Prometheus-on-Kubernetes.png?fit=360%2C240&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3677,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-k3s-cluster-and-helm\/","url_meta":{"origin":3655,"position":3},"title":"How to install K3s Cluster and Helm","author":"George B.","date":"July 27, 2023","format":false,"excerpt":"In this tutorial, we are going to explore how to install K3s and Helm. K3s is a lightweight Kubernetes distribution designed for developers and operators looking for a method to run Kubernetes in resource-constrained environments. Helm, on the other hand, is a package manager for Kubernetes that simplifies the deployment\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/How-to-install-K3s-Cluster-and-Helm.png?fit=360%2C240&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3687,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-mongodb-on-kubernetes\/","url_meta":{"origin":3655,"position":4},"title":"How to Deploy MongoDB on Kubernetes","author":"George B.","date":"July 29, 2023","format":false,"excerpt":"This tutorial will walk you through installing MongoDB on Kubernetes cluster. We'll assume that you've already got K3s and Helm set up on your machine. The deployment of applications like MongoDB on Kubernetes cluster is made easier by the Kubernetes package manager Helm. Before getting too technical, it's important to\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/How-to-Deploy-MongoDB-on-Kubernetes.png?fit=360%2C240&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3981,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-argocd-on-kubernetes\/","url_meta":{"origin":3655,"position":5},"title":"How to Deploy ArgoCD on Kubernetes","author":"George B.","date":"October 3, 2023","format":false,"excerpt":"Let\u2019s get started with deploying ArgoCD on Kubernetes. With the rise of containerization and orchestration technologies, Kubernetes has become the de facto standard for container management. When it comes to Continuous Deployment (CD) in Kubernetes environments, ArgoCD stands out as an impressive tool. Designed specifically for Kubernetes, ArgoCD bridges the\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/10\/Deploy-ArgoCD-on-Kubernetes.png?fit=360%2C240&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts\/3655","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/comments?post=3655"}],"version-history":[{"count":3,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts\/3655\/revisions"}],"predecessor-version":[{"id":3671,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts\/3655\/revisions\/3671"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/media\/3661"}],"wp:attachment":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/media?parent=3655"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/categories?post=3655"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/tags?post=3655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}