{"id":5175,"date":"2026-11-18T21:21:39","date_gmt":"2026-11-18T21:21:39","guid":{"rendered":"https:\/\/bitflow-solutions.com\/guias-tecnicas\/migrate-service-to-ionos-cloud\/"},"modified":"2026-11-18T21:21:39","modified_gmt":"2026-11-18T21:21:39","slug":"migrate-service-to-ionos-cloud","status":"publish","type":"bf_guia","link":"https:\/\/bitflow-solutions.com\/en\/guias-tecnicas\/migrate-service-to-ionos-cloud\/","title":{"rendered":"Migrate a service to IONOS Cloud: Kubernetes, PostgreSQL and Object Storage"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A practical guide to <strong>migrating a service to IONOS Cloud<\/strong>, the European provider: a containerised API with its PostgreSQL database and its files, from the inventory to the DNS switch. All the commands have been checked against the official IONOS documentation, and you also have them in the <strong>README.md<\/strong> on the left.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What you\u2019ll learn<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>How to move the parts of a service (application, database and files) to their equivalents in IONOS Cloud.<\/li>\n\n\n<li>Setting up <code>ionosctl<\/code> on Windows, checking the contract quotas and creating the virtual data centre.<\/li>\n\n\n<li>Creating a Managed Kubernetes cluster connected to a managed PostgreSQL database on a private network.<\/li>\n\n\n<li>Migrating the database with <code>pg_dump<\/code> \/ <code>pg_restore<\/code> and the files to Object Storage.<\/li>\n\n\n<li>Deploying, validating and switching DNS with as little downtime as possible.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>An <strong>IONOS Cloud<\/strong> contract with access to the Data Center Designer (DCD).<\/li>\n\n\n<li><strong>Windows<\/strong> with PowerShell, <strong>Scoop<\/strong> (to install ionosctl), <strong>kubectl<\/strong>, <strong>Docker Desktop<\/strong> and the <strong>AWS CLI<\/strong> (used against IONOS Object Storage).<\/li>\n\n\n<li>The service to migrate packaged in a container image (see the FastAPI guide or the Spring Boot guide) and access to its source database.<\/li>\n\n\n<li>Basic knowledge of Kubernetes (see the Kubernetes administration guide).<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Step by step<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Plan the migration<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Take an inventory of what is being migrated and decide where each part goes:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>What you have today<\/th><th>Where it goes in IONOS Cloud<\/th><\/tr><\/thead><tbody><tr><td>Application servers or containers<\/td><td>Managed Kubernetes (or Dedicated Core \/ vCPU servers in a VDC)<\/td><\/tr><tr><td>Container images<\/td><td>Private Container Registry<\/td><\/tr><tr><td>PostgreSQL database<\/td><td>DBaaS PostgreSQL (versions 14 to 18), on a private LAN<\/td><\/tr><tr><td>Files and documents<\/td><td>Object Storage, S3-compatible<\/td><\/tr><tr><td>Load balancer and certificates<\/td><td>Application or Network Load Balancer and Certificate Manager<\/td><\/tr><tr><td>DNS<\/td><td>Cloud DNS (or your current provider)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Choose a <strong>location<\/strong> and don\u2019t change it: the virtual data centre (VDC) cannot be moved afterwards. For data in Spain or the EU, for example <code>de\/fra<\/code> (Frankfurt) or <code>es\/vit<\/code> (Vitoria). Lower the TTL of the DNS records you are going to change well in advance, so that the final switch propagates quickly.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Install ionosctl and authenticate<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Install ionosctl on Windows with Scoop\nscoop bucket add ionos-cloud https:\/\/github.com\/ionos-cloud\/scoop-bucket.git\nscoop install ionos-cloud\/ionosctl\n\n# Log in and create a token for the migration (valid for one year at most)\nionosctl login\nionosctl token generate<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For scripts and pipelines, use the token in the <code>IONOS_TOKEN<\/code> environment variable instead of a username and password.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Check locations and quotas<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Each contract has limits on cores, RAM, storage, IPs and clusters. Check them before you start; if they are not enough, ask IONOS support to increase them:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ionosctl compute location list    # available locations (de\/fra, de\/txl, es\/vit\u2026)\nionosctl compute contract get     # contract limits: cores, RAM, storage, IPs, clusters\u2026<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. Create the virtual data centre and the private network<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>ionosctl compute datacenter create --name \"vdc-production\" --location de\/fra<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then, in the DCD, add a <strong>private LAN<\/strong> to the VDC for the database (LAN 3 in the examples). The managed database is only reachable from private networks.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5. Create the Kubernetes cluster<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The node pool is connected to the private LAN so that the pods can reach the database:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Cluster (always specify the location: the default is not in Europe)\nionosctl compute k8s cluster create --name k8s-production --location de\/fra --wait\n\n# Node pool in the VDC, also connected to the database's private LAN (LAN 3 in the example)\nionosctl compute k8s nodepool create --cluster-id CLUSTER_ID --datacenter-id DATACENTER_ID `\n  --name pool-a --lan-ids 3 --dhcp=true --wait\n\n# Credentials for kubectl\nionosctl compute k8s kubeconfig get --cluster-id CLUSTER_ID &gt; kubeconfig.yaml\n$env:KUBECONFIG = \"$PWD\\kubeconfig.yaml\"\nkubectl get nodes<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">6. Push the image to the container registry<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>ionosctl container-registry registry create --name company-registry --location de\/txl\nionosctl container-registry token create --registry-id REGISTRY_ID --name deploy\n# The token must be given permissions (scopes) before it is used; its password is shown only once<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The registry server name appears in the DCD (<em>Containers \u2192 Container Registry<\/em>). Tag and push the image:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker login &lt;registry-server&gt; -u deploy\ndocker tag tasks-api:1.4.0 &lt;registry-server&gt;\/tasks-api:1.4.0\ndocker push &lt;registry-server&gt;\/tasks-api:1.4.0<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7. Create the managed database<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">PostgreSQL as a service, on the private LAN and with an IP from that network. Choose the same major version as the source (or higher):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ionosctl dbaas postgres-v2 cluster create `\n  --datacenter-id DATACENTER_ID --lan-id 3 --cidr 192.168.1.10\/24 `\n  --db-username admin_app --db-password \"********\" `\n  --database orders --version 17<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Connections are always encrypted with TLS. The users and roles from the source database have to be created by hand in the new one: the managed service does not give superuser access.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">8. Migrate the PostgreSQL data<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For the final migration, <strong>stop the application\u2019s writes<\/strong> at the source so you don\u2019t lose data. Take the dump:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># On the source server: dump in custom format (-F c)\npg_dump -U app -h source.company.local -p 5432 -F c orders -f orders.dump<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And restore it from a temporary pod inside the cluster, which can reach the database\u2019s private network:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># A temporary pod with the PostgreSQL client inside the cluster (which can reach the private LAN)\nkubectl run pg-client --image=postgres:17 --restart=Never -- sleep 3600\nkubectl cp orders.dump pg-client:\/tmp\/orders.dump\n\n# Restore into the IONOS database (with 4 parallel jobs)\nkubectl exec -it pg-client -- pg_restore -U admin_app -h 192.168.1.10 -p 5432 -F c -d orders -j 4 \/tmp\/orders.dump\n\n# Check and delete the temporary pod\nkubectl exec -it pg-client -- psql -U admin_app -h 192.168.1.10 -d orders -c \"SELECT count(*) FROM orders;\"\nkubectl delete pod pg-client<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Compare the row counts of the main tables at the source and the target before continuing.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">9. Migrate the files to Object Storage<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">IONOS Object Storage is S3-compatible, so the AWS CLI works as long as you specify the IONOS endpoint in <strong>every<\/strong> command. In the example, the <code>de<\/code> region (Frankfurt):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Keys from DCD &gt; Storage &amp; Backup &gt; Object Storage &gt; Key management; region: de\naws configure\n\naws s3 mb s3:\/\/company-documents --endpoint-url https:\/\/s3.eu-central-1.ionoscloud.com\naws s3 sync .\\documents s3:\/\/company-documents --endpoint-url https:\/\/s3.eu-central-1.ionoscloud.com\naws s3 ls s3:\/\/company-documents --endpoint-url https:\/\/s3.eu-central-1.ionoscloud.com<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">10. Deploy the service and validate it<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Store the database connection in a secret, deploy and test internally before opening it to the public:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl create secret generic db-orders --from-literal=DB_URL=\"postgresql:\/\/192.168.1.10:5432\/orders?sslmode=require\" `\n  --from-literal=DB_USER=admin_app --from-literal=DB_PASSWORD=\"********\"\nkubectl apply -f deployment.yaml\nkubectl rollout status deployment\/tasks-api\nkubectl port-forward deploy\/tasks-api 8080:80   # test at http:\/\/localhost:8080 before opening it to the public<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">11. Switch DNS and retire the old environment<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Expose the service (Ingress with its load balancer, or an Application Load Balancer) and its certificate.<\/li>\n\n\n<li>Change the DNS records to the new IP. With a low TTL, the change arrives within minutes.<\/li>\n\n\n<li>Monitor logs and metrics for a few days and keep the old environment switched off but available, in case you need to roll back.<\/li>\n\n\n<li>When everything is stable, retire the old environment and raise the TTL again.<\/li>\n\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">12. Optional: describe the infrastructure with Terraform<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To make the infrastructure reproducible, the official Terraform provider creates the same resources from code (token in the <code>IONOS_TOKEN<\/code> variable or in <code>var.ionos_token<\/code>):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>terraform {\n  required_providers {\n    ionoscloud = { source = \"ionos-cloud\/ionoscloud\", version = \"&gt;= 6.4.10\" }\n  }\n}\n\nprovider \"ionoscloud\" {\n  token = var.ionos_token\n}\n\nresource \"ionoscloud_datacenter\" \"production\" {\n  name     = \"vdc-production\"\n  location = \"de\/fra\"\n}\n\nresource \"ionoscloud_k8s_cluster\" \"production\" {\n  name        = \"k8s-production\"\n  k8s_version = \"1.31.2\"\n  maintenance_window {\n    day_of_the_week = \"Sunday\"\n    time            = \"09:00:00Z\"\n  }\n}\n\nresource \"ionoscloud_k8s_node_pool\" \"general\" {\n  datacenter_id     = ionoscloud_datacenter.production.id\n  k8s_cluster_id    = ionoscloud_k8s_cluster.production.id\n  name              = \"pool-a\"\n  k8s_version       = ionoscloud_k8s_cluster.production.k8s_version\n  availability_zone = \"AUTO\"\n  storage_type      = \"SSD\"\n  node_count        = 2\n  cores_count       = 2\n  ram_size          = 4096\n  storage_size      = 40\n  server_type       = \"DedicatedCore\"\n  cpu_family        = \"INTEL_XEON\"\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Common errors<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Resources created outside Europe<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Some commands have a default location that is not the one you expect (for example, cluster creation). Always specify <code>--location<\/code> and check the location of each resource.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The application cannot reach the database<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The managed database is only on the private LAN. The node pool must be connected to that same LAN (<code>--lan-ids<\/code>) with DHCP, and the connection string must use its private IP.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The database network range is not accepted<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Some ranges are reserved by IONOS and cannot be used for the database: <code>10.208.0.0\/12<\/code>, <code>10.233.0.0\/18<\/code>, <code>10.233.64.0\/18<\/code> and <code>192.168.230.0\/24<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u201cpg_dumpall\u201d or restoring roles fails<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A managed database has no superuser. Dump only the database with <code>pg_dump<\/code> and create the users and roles by hand at the target.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The contract quota runs out halfway through the migration<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Check the limits with <code>ionosctl compute contract get<\/code> before you start and request the increase in good time: it is not immediate.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The AWS CLI connects to Amazon instead of IONOS<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The command is missing <code>--endpoint-url<\/code>. With IONOS Object Storage you must always specify it, and it must match the bucket\u2019s region.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">A Service of type LoadBalancer does not get an IP<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Private node pools (behind a NAT Gateway) do not support Services of type LoadBalancer. Use a public node pool for ingress or an Application Load Balancer.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Next steps<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Automate deployment to the new cluster with a pipeline (see the CI\/CD with GitHub Actions guide).<\/li>\n\n\n<li>Enable backups and test a real restore of the database.<\/li>\n\n\n<li>Move the DNS records to Cloud DNS and automate them from Kubernetes with ExternalDNS.<\/li>\n\n\n<li>Define alerts on usage against the contract quotas.<\/li>\n\n<\/ul>\n\n\n","protected":false},"excerpt":{"rendered":"<p>How to move a containerised API, its PostgreSQL database and its files to IONOS Cloud with ionosctl: virtual data centre, Managed Kubernetes, DBaaS on a private network, Object Storage and DNS switch.<\/p>\n","protected":false},"featured_media":0,"template":"","bf_tecnologia":[103],"bf_nivel":[109],"class_list":["post-5175","bf_guia","type-bf_guia","status-publish","hentry","bf_tecnologia-cloud-en","bf_nivel-intermediate"],"acf":[],"_links":{"self":[{"href":"https:\/\/bitflow-solutions.com\/en\/wp-json\/wp\/v2\/bf_guia\/5175","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bitflow-solutions.com\/en\/wp-json\/wp\/v2\/bf_guia"}],"about":[{"href":"https:\/\/bitflow-solutions.com\/en\/wp-json\/wp\/v2\/types\/bf_guia"}],"version-history":[{"count":0,"href":"https:\/\/bitflow-solutions.com\/en\/wp-json\/wp\/v2\/bf_guia\/5175\/revisions"}],"wp:attachment":[{"href":"https:\/\/bitflow-solutions.com\/en\/wp-json\/wp\/v2\/media?parent=5175"}],"wp:term":[{"taxonomy":"bf_tecnologia","embeddable":true,"href":"https:\/\/bitflow-solutions.com\/en\/wp-json\/wp\/v2\/bf_tecnologia?post=5175"},{"taxonomy":"bf_nivel","embeddable":true,"href":"https:\/\/bitflow-solutions.com\/en\/wp-json\/wp\/v2\/bf_nivel?post=5175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}