{"id":2665,"date":"2020-03-02T09:13:25","date_gmt":"2020-03-02T08:13:25","guid":{"rendered":"https:\/\/geko2.factoryfy.com\/how-to-set-up-a-high-availability-haproxy-in-google-cloud-with-keepalived\/"},"modified":"2021-11-03T17:36:50","modified_gmt":"2021-11-03T16:36:50","slug":"setup-haproxy-googlecloud-keepalived","status":"publish","type":"post","link":"https:\/\/geko.cloud\/en\/setup-haproxy-googlecloud-keepalived\/","title":{"rendered":"How to set up a High-Availability HAProxy in Google Cloud with Keepalived"},"content":{"rendered":"<p>Yes, you may think:<em> &#8220;What? Google Cloud has it&#8217;s own load balancer managed service. Why you want to configure and manage a dedicated HA load balancer?<\/em>&#8220;. We recommend using GCP Load Balancer service always as you can. It&#8217;s a very reliable service and you don&#8217;t have to manage your own load balancer in a High-Availability configuration.<\/p>\n<p>But sometimes there are some situations that the GCP Load Balancer doesn&#8217;t fit your needs or, simply you don&#8217;t want to use it&#8230; In those cases we have a very simple configuration using two well known pieces of software: <strong>HAProxy<\/strong> and <strong>Keepalived<\/strong>.<\/p>\n<p>Keepalived uses Virtual Router Redundancy Protocol (<a href=\"https:\/\/tools.ietf.org\/html\/rfc3768\" target=\"external\" rel=\"noopener noreferrer\">VRRP<\/a>) and floating IP addresses that can &#8216;move&#8217; from one VM to another in case of one of them becomes unavailable. In a classic and on-prem environment this is something like that:<\/p>\n<figure id=\"attachment_912\" aria-describedby=\"caption-attachment-912\" style=\"width: 634px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/geko2.factoryfy.com\/wp-content\/uploads\/floating-ip-on-premises-environment.svg\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-912 \" src=\"https:\/\/geko2.factoryfy.com\/wp-content\/uploads\/floating-ip-on-premises-environment.svg\" alt=\"\" width=\"634\" height=\"181\" \/><\/a><figcaption id=\"caption-attachment-912\" class=\"wp-caption-text\">Image source: Google Cloud<\/figcaption><\/figure>\n<p>In case of a server failure, when the other server takes over the floating IP addresses, it adds these addresses to its network interface. The server announces this takeover to other devices using Layer 2 by sending a\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/Address_Resolution_Protocol#ARP_announcements\" target=\"external\" rel=\"noopener noreferrer\">gratuitous Address Resolution Protocol (ARP) frame<\/a>. Google Compute Engine uses a virtualized network stack and\u00a0typical implementation mechanisms don&#8217;t work here. The VPC network handles ARP requests based on the configured routing topology, and ignores gratuitous ARP frames.<\/p>\n<p>First of all, you need to install haproxy and keepalived in your server. In this case, we used\u00a0<strong>Ubuntu 18.04<\/strong>. Just run:<\/p>\n<pre>sudo apt install haproxy \r\nsudo apt install keepalived<\/pre>\n<p>For this tutorial we will configure an <strong>internal load balancer<\/strong> but you can also configure an external load balancer with some small modifications.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-945 aligncenter\" src=\"https:\/\/geko2.factoryfy.com\/wp-content\/uploads\/screenshot-20200228160149-911x611.png\" alt=\"\" width=\"619\" height=\"415\" \/><\/p>\n<p>We&#8217;ll use this <span style=\"font-weight: 400;\"><strong>\/etc\/haproxy\/haproxy.cfg<\/strong> file in both servers. Both servers (MASTER and BACKUP)\u00a0<strong>need to have exactly <span style=\"text-decoration: underline;\">the same<\/span> HAProxy configuration<\/strong>.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">global<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0log \/dev\/log\u00a0 \u00a0 local0 debug\r\n<\/span><span style=\"font-weight: 400;\">        log \/dev\/log\u00a0 \u00a0 local1 debug<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0chroot \/var\/lib\/haproxy<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0stats socket \/run\/haproxy\/admin.sock mode 660 level admin expose-fd listeners<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0stats timeout 30s<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0user haproxy<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0group haproxy<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0daemon<\/span>\r\n\r\n<span style=\"font-weight: 400;\">defaults<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0log \u00a0 \u00a0 global<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0mode\u00a0 \u00a0 http<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0option\u00a0 dontlognull<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0timeout connect 5000<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0timeout client\u00a0 50000<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0timeout server\u00a0 50000<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0errorfile 400 \/etc\/haproxy\/errors\/400.http<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0errorfile 403 \/etc\/haproxy\/errors\/403.http<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0errorfile 408 \/etc\/haproxy\/errors\/408.http<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0errorfile 500 \/etc\/haproxy\/errors\/500.http<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0errorfile 502 \/etc\/haproxy\/errors\/502.http<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0errorfile 503 \/etc\/haproxy\/errors\/503.http<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0errorfile 504 \/etc\/haproxy\/errors\/504.http<\/span>\r\n\r\n<span style=\"font-weight: 400;\">frontend service-1<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0bind 192.168.240.140:443<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0mode tcp<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0option tcplog<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0log global<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0default_backend service-1-be<\/span>\r\n<span style=\"font-weight: 400;\">backend service-1-be<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0mode tcp<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0server service-1-server-1 10.152.0.220:443 check id 1\r\n  server service-1-server-2 10.152.0.221:443 check id 2\r\n\r\n\r\n<\/span>frontend service-2\r\n\u00a0\u00a0bind 192.168.240.141:443\r\n\u00a0\u00a0mode tcp\r\n\u00a0\u00a0option tcplog\r\n\u00a0\u00a0log global\r\n\u00a0\u00a0default_backend service-2-be\r\nbackend service-2-be\r\n\u00a0\u00a0mode tcp\r\n\u00a0\u00a0server service-2-server-1 10.10.0.40:443 check id 1\r\n  server service-2-server-2 10.10.0.41:443 check id 2<\/pre>\n<p>In this example, the two floating IPs will be: <strong>192.168.240.140<\/strong> and <strong>192.168.240.141<\/strong>.<\/p>\n<p>Don&#8217;t forget to restart the haproxy service(sudo systemctl restart haproxy) every time you change the config file. \ud83d\ude09<\/p>\n<p>For the<b> \/etc\/keepalived\/keepalived.conf<\/b> configuration file we will use these two config files in the master and slave VMs:<\/p>\n<h3>MASTER<\/h3>\n<pre><span style=\"font-weight: 400;\">vrrp_instance floating_ip {<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0state MASTER<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0interface ens4<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0unicast_src_ip 192.168.240.10<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0unicast_peer {<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0192.168.240.11<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0}<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0virtual_router_id 50<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0priority 100<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0authentication {<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0auth_type PASS<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0auth_pass your_passwd<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0}<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0notify_master \/etc\/keepalived\/takeover.sh root<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h3>BACKUP<\/h3>\n<pre>vrrp_instance floating_ip {\r\n\u00a0\u00a0\u00a0\u00a0state BACKUP\r\n\u00a0\u00a0\u00a0\u00a0interface ens4\r\n\u00a0\u00a0\u00a0\u00a0unicast_src_ip 192.168.240.11\r\n\u00a0\u00a0\u00a0\u00a0unicast_peer {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0192.168.240.10\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n\u00a0\u00a0\u00a0\u00a0virtual_router_id 50\r\n\u00a0\u00a0\u00a0\u00a0priority 50\r\n\u00a0\u00a0\u00a0\u00a0authentication {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0auth_type PASS\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0auth_pass your_passwd\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0\u00a0notify_master \/etc\/keepalived\/takeover.sh root\r\n}<\/pre>\n<p>Don&#8217;t forget to restart the keepalived service (sudo systemctl restart keepalived) every time you change the config file. \ud83d\ude09<\/p>\n<p>And now the part that does the &#8216;magic&#8217;: the\u00a0<strong>\/etc\/keepalived\/takeover.sh<\/strong>\u00a0script. Basically, this script unassigns IP aliases from the peer that is down and assigns them to himself. After that, haproxy service is reloaded to allow haproxy to bind to the floating IPs.<\/p>\n<h3>MASTER<\/h3>\n<pre># Unassign peer's IP aliases. Try it until it's possible.\r\nuntil gcloud compute instances network-interfaces update haproxy-prod-backup --zone europe-west1-c --aliases \"\" &gt; \/etc\/keepalived\/takeover.log 2&gt;&amp;1; do\r\n\u00a0\u00a0\u00a0\u00a0echo \"Instance not accessible during takeover. Retrying in 5 seconds...\"\r\n\u00a0\u00a0\u00a0\u00a0sleep 5\r\ndone\r\n\r\n# Assign IP aliases to me because now I am the MASTER!\r\ngcloud compute instances network-interfaces update haproxy-prod \r\n\u00a0\u00a0\u00a0\u00a0--zone europe-west1-b \r\n\u00a0\u00a0\u00a0\u00a0--aliases \"192.168.240.140\/32;192.168.240.141\/32\" &gt;&gt; \/etc\/keepalived\/takeover.log 2&gt;&amp;1\r\nsystemctl restart haproxy\r\necho \"I became the MASTER at: $(date)\" &gt;&gt; \/etc\/keepalived\/takeover.log\r\n\r\n<\/pre>\n<h3>BACKUP<\/h3>\n<pre># Unassign peer's IP aliases. Try it until it's possible.\r\nuntil gcloud compute instances network-interfaces update haproxy-prod --zone europe-west1-b --aliases \"\" &gt; \/etc\/keepalived\/takeover.log 2&gt;&amp;1; do\r\n\u00a0\u00a0\u00a0\u00a0echo \"Instance not accessible during takeover. Retrying in 5 seconds...\"\r\n\u00a0\u00a0\u00a0\u00a0sleep 5\r\ndone\r\n\r\n# Assign IP aliases to me because now I am the MASTER!\r\ngcloud compute instances network-interfaces update haproxy-prod-backup \r\n\u00a0\u00a0\u00a0\u00a0--zone europe-west1-c \r\n\u00a0\u00a0\u00a0\u00a0--aliases \"192.168.240.140\/32;192.168.240.141\/32\" &gt;&gt; \/etc\/keepalived\/takeover.log 2&gt;&amp;1\r\nsystemctl restart haproxy\r\necho \"I became the MASTER at: $(date)\" &gt;&gt; \/etc\/keepalived\/takeover.log\r\n<\/pre>\n<p>In fact, all that we do is assign\/unassing IP alias depending on what VM is the MASTER.<\/p>\n<p>Easy, isn&#8217;t it? \ud83d\ude42<\/p>\n<hr \/>\n<p>I hope you&#8217;ve enjoyed this post and I encourage you to <a href=\"https:\/\/geko.cloud\/en\/blog\/\">check our blog for other posts<\/a> that you might find helpful, such as &#8220;<a href=\"https:\/\/geko.cloud\/en\/what-is-the-cloud\/\">What is the cloud?<\/a>&#8220;. <a href=\"https:\/\/geko.cloud\/en\/contact\/\">Do not hesitate to contact us<\/a> if you would like us to help you on your projects.<\/p>\n<p>See you on the next post!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yes, you may think: &#8220;What? Google Cloud has it&#8217;s own load balancer managed service. Why you want to configure and manage a dedicated HA load balancer?&#8220;. We recommend using GCP Load Balancer service always as you can. It&#8217;s a very reliable service and you don&#8217;t have to manage your own load balancer in a High-Availability [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":2348,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[67],"tags":[78,80],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to set up HAProxy in GCP with Keepalived<\/title>\n<meta name=\"description\" content=\"How to set up HAProxy in GCP with Keepalived: Sometimes there are situations where the GCP Load Balancer doesn&#039;t fit your needs or you just don&#039;t want to use it. In those cases we have a very simple setup using two well-known pieces of software: HAProxy and Keepalived. Learn all the steps from cloud experts.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to set up HAProxy in GCP with Keepalived\" \/>\n<meta property=\"og:description\" content=\"How to set up HAProxy in GCP with Keepalived: Sometimes there are situations where the GCP Load Balancer doesn&#039;t fit your needs or you just don&#039;t want to use it. In those cases we have a very simple setup using two well-known pieces of software: HAProxy and Keepalived. Learn all the steps from cloud experts.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/\" \/>\n<meta property=\"og:site_name\" content=\"Geko Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-02T08:13:25+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-11-03T16:36:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/geko.cloud\/wp-content\/uploads\/keepalived.png\" \/>\n\t<meta property=\"og:image:width\" content=\"751\" \/>\n\t<meta property=\"og:image:height\" content=\"380\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Jose Luis S\u00e1nchez\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@geko_cloud\" \/>\n<meta name=\"twitter:site\" content=\"@geko_cloud\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/\"},\"author\":{\"name\":\"Jose Luis S\u00e1nchez\",\"@id\":\"https:\/\/geko.cloud\/es\/#\/schema\/person\/d06aff498ebfbc75b5010ebe92af41ed\"},\"headline\":\"How to set up a High-Availability HAProxy in Google Cloud with Keepalived\",\"datePublished\":\"2020-03-02T08:13:25+00:00\",\"dateModified\":\"2021-11-03T16:36:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/\"},\"wordCount\":491,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/geko.cloud\/es\/#organization\"},\"image\":{\"@id\":\"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/geko.cloud\/wp-content\/uploads\/keepalived.png\",\"keywords\":[\"Google Cloud\",\"HAproxy\"],\"articleSection\":[\"Labs\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/\",\"url\":\"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/\",\"name\":\"How to set up HAProxy in GCP with Keepalived\",\"isPartOf\":{\"@id\":\"https:\/\/geko.cloud\/es\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/geko.cloud\/wp-content\/uploads\/keepalived.png\",\"datePublished\":\"2020-03-02T08:13:25+00:00\",\"dateModified\":\"2021-11-03T16:36:50+00:00\",\"description\":\"How to set up HAProxy in GCP with Keepalived: Sometimes there are situations where the GCP Load Balancer doesn't fit your needs or you just don't want to use it. In those cases we have a very simple setup using two well-known pieces of software: HAProxy and Keepalived. Learn all the steps from cloud experts.\",\"breadcrumb\":{\"@id\":\"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/#primaryimage\",\"url\":\"https:\/\/geko.cloud\/wp-content\/uploads\/keepalived.png\",\"contentUrl\":\"https:\/\/geko.cloud\/wp-content\/uploads\/keepalived.png\",\"width\":751,\"height\":380,\"caption\":\"keepalived logo\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Portada\",\"item\":\"https:\/\/geko.cloud\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to set up a High-Availability HAProxy in Google Cloud with Keepalived\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/geko.cloud\/es\/#website\",\"url\":\"https:\/\/geko.cloud\/es\/\",\"name\":\"Geko Cloud\",\"description\":\"Servicios de consultor\u00eda cloud y devops\",\"publisher\":{\"@id\":\"https:\/\/geko.cloud\/es\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/geko.cloud\/es\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/geko.cloud\/es\/#organization\",\"name\":\"Geko Cloud\",\"url\":\"https:\/\/geko.cloud\/es\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/geko.cloud\/es\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/geko.cloud\/wp-content\/uploads\/2021\/10\/geko_logo-positivo.png\",\"contentUrl\":\"https:\/\/geko.cloud\/wp-content\/uploads\/2021\/10\/geko_logo-positivo.png\",\"width\":1650,\"height\":809,\"caption\":\"Geko Cloud\"},\"image\":{\"@id\":\"https:\/\/geko.cloud\/es\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/geko_cloud\",\"https:\/\/www.instagram.com\/gekocloud\/\",\"https:\/\/www.linkedin.com\/company\/gekocloud\",\"https:\/\/www.youtube.com\/channel\/UC5EFLCqUM7fEaXSa_0nWowQ\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/geko.cloud\/es\/#\/schema\/person\/d06aff498ebfbc75b5010ebe92af41ed\",\"name\":\"Jose Luis S\u00e1nchez\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/geko.cloud\/es\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ebfd055d4dba456220c682523fcc237c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ebfd055d4dba456220c682523fcc237c?s=96&d=mm&r=g\",\"caption\":\"Jose Luis S\u00e1nchez\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to set up HAProxy in GCP with Keepalived","description":"How to set up HAProxy in GCP with Keepalived: Sometimes there are situations where the GCP Load Balancer doesn't fit your needs or you just don't want to use it. In those cases we have a very simple setup using two well-known pieces of software: HAProxy and Keepalived. Learn all the steps from cloud experts.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/","og_locale":"en_US","og_type":"article","og_title":"How to set up HAProxy in GCP with Keepalived","og_description":"How to set up HAProxy in GCP with Keepalived: Sometimes there are situations where the GCP Load Balancer doesn't fit your needs or you just don't want to use it. In those cases we have a very simple setup using two well-known pieces of software: HAProxy and Keepalived. Learn all the steps from cloud experts.","og_url":"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/","og_site_name":"Geko Cloud","article_published_time":"2020-03-02T08:13:25+00:00","article_modified_time":"2021-11-03T16:36:50+00:00","og_image":[{"width":751,"height":380,"url":"https:\/\/geko.cloud\/wp-content\/uploads\/keepalived.png","type":"image\/png"}],"author":"Jose Luis S\u00e1nchez","twitter_card":"summary_large_image","twitter_creator":"@geko_cloud","twitter_site":"@geko_cloud","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/#article","isPartOf":{"@id":"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/"},"author":{"name":"Jose Luis S\u00e1nchez","@id":"https:\/\/geko.cloud\/es\/#\/schema\/person\/d06aff498ebfbc75b5010ebe92af41ed"},"headline":"How to set up a High-Availability HAProxy in Google Cloud with Keepalived","datePublished":"2020-03-02T08:13:25+00:00","dateModified":"2021-11-03T16:36:50+00:00","mainEntityOfPage":{"@id":"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/"},"wordCount":491,"commentCount":0,"publisher":{"@id":"https:\/\/geko.cloud\/es\/#organization"},"image":{"@id":"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/#primaryimage"},"thumbnailUrl":"https:\/\/geko.cloud\/wp-content\/uploads\/keepalived.png","keywords":["Google Cloud","HAproxy"],"articleSection":["Labs"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/","url":"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/","name":"How to set up HAProxy in GCP with Keepalived","isPartOf":{"@id":"https:\/\/geko.cloud\/es\/#website"},"primaryImageOfPage":{"@id":"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/#primaryimage"},"image":{"@id":"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/#primaryimage"},"thumbnailUrl":"https:\/\/geko.cloud\/wp-content\/uploads\/keepalived.png","datePublished":"2020-03-02T08:13:25+00:00","dateModified":"2021-11-03T16:36:50+00:00","description":"How to set up HAProxy in GCP with Keepalived: Sometimes there are situations where the GCP Load Balancer doesn't fit your needs or you just don't want to use it. In those cases we have a very simple setup using two well-known pieces of software: HAProxy and Keepalived. Learn all the steps from cloud experts.","breadcrumb":{"@id":"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/#primaryimage","url":"https:\/\/geko.cloud\/wp-content\/uploads\/keepalived.png","contentUrl":"https:\/\/geko.cloud\/wp-content\/uploads\/keepalived.png","width":751,"height":380,"caption":"keepalived logo"},{"@type":"BreadcrumbList","@id":"https:\/\/geko.cloud\/es\/configurar-haproxy-googlecloud-keepalived\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Portada","item":"https:\/\/geko.cloud\/en\/"},{"@type":"ListItem","position":2,"name":"How to set up a High-Availability HAProxy in Google Cloud with Keepalived"}]},{"@type":"WebSite","@id":"https:\/\/geko.cloud\/es\/#website","url":"https:\/\/geko.cloud\/es\/","name":"Geko Cloud","description":"Servicios de consultor\u00eda cloud y devops","publisher":{"@id":"https:\/\/geko.cloud\/es\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/geko.cloud\/es\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/geko.cloud\/es\/#organization","name":"Geko Cloud","url":"https:\/\/geko.cloud\/es\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/geko.cloud\/es\/#\/schema\/logo\/image\/","url":"https:\/\/geko.cloud\/wp-content\/uploads\/2021\/10\/geko_logo-positivo.png","contentUrl":"https:\/\/geko.cloud\/wp-content\/uploads\/2021\/10\/geko_logo-positivo.png","width":1650,"height":809,"caption":"Geko Cloud"},"image":{"@id":"https:\/\/geko.cloud\/es\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/geko_cloud","https:\/\/www.instagram.com\/gekocloud\/","https:\/\/www.linkedin.com\/company\/gekocloud","https:\/\/www.youtube.com\/channel\/UC5EFLCqUM7fEaXSa_0nWowQ"]},{"@type":"Person","@id":"https:\/\/geko.cloud\/es\/#\/schema\/person\/d06aff498ebfbc75b5010ebe92af41ed","name":"Jose Luis S\u00e1nchez","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/geko.cloud\/es\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ebfd055d4dba456220c682523fcc237c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ebfd055d4dba456220c682523fcc237c?s=96&d=mm&r=g","caption":"Jose Luis S\u00e1nchez"}}]}},"_links":{"self":[{"href":"https:\/\/geko.cloud\/en\/wp-json\/wp\/v2\/posts\/2665"}],"collection":[{"href":"https:\/\/geko.cloud\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geko.cloud\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geko.cloud\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/geko.cloud\/en\/wp-json\/wp\/v2\/comments?post=2665"}],"version-history":[{"count":3,"href":"https:\/\/geko.cloud\/en\/wp-json\/wp\/v2\/posts\/2665\/revisions"}],"predecessor-version":[{"id":5199,"href":"https:\/\/geko.cloud\/en\/wp-json\/wp\/v2\/posts\/2665\/revisions\/5199"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/geko.cloud\/en\/wp-json\/wp\/v2\/media\/2348"}],"wp:attachment":[{"href":"https:\/\/geko.cloud\/en\/wp-json\/wp\/v2\/media?parent=2665"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geko.cloud\/en\/wp-json\/wp\/v2\/categories?post=2665"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geko.cloud\/en\/wp-json\/wp\/v2\/tags?post=2665"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}