<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>GKE archivos - Geko Cloud</title>
	<atom:link href="https://geko.cloud/en/tag/gke-en/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>Servicios de consultoría cloud y devops</description>
	<lastBuildDate>Wed, 03 Nov 2021 10:03:27 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.7</generator>

<image>
	<url>https://geko.cloud/wp-content/uploads/2021/08/cropped-geko-fav-150x150.png</url>
	<title>GKE archivos - Geko Cloud</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>GCP/GKE – New logging system</title>
		<link>https://geko.cloud/en/gcp-gke-new-logging-system/</link>
					<comments>https://geko.cloud/en/gcp-gke-new-logging-system/#respond</comments>
		
		<dc:creator><![CDATA[Geko Cloud]]></dc:creator>
		<pubDate>Mon, 07 Sep 2020 05:27:04 +0000</pubDate>
				<category><![CDATA[News]]></category>
		<category><![CDATA[GKE]]></category>
		<category><![CDATA[Google Cloud]]></category>
		<category><![CDATA[Kubernetes]]></category>
		<guid isPermaLink="false">https://geko2.factoryfy.com/gcp-gke-new-logging-system/</guid>

					<description><![CDATA[<p>Introduction It&#8217;s very likely you have been running a GKE cluster at the version v1.15 for many months without issues and then -suddenly- the logs stopped being received. You are using the default logging system the system provides, so you then check the GCP status website but everything is running fine. You also know you [&#8230;]</p>
<p>La entrada <a href="https://geko.cloud/en/gcp-gke-new-logging-system/">GCP/GKE – New logging system</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>It&#8217;s very likely you have been running a <a href="https://cloud.google.com/kubernetes-engine/docs/concepts/kubernetes-engine-overview">GKE</a> cluster at the version v1.15 for many months without issues and then -suddenly- the logs stopped being received. You are using the default logging system the system provides, so you then check the <a href="https://status.cloud.google.com/">GCP status website</a> but everything is running fine. You also know you have not modified anything on the cluster before the log stop, but at the same time you guess it has to be something on your side (on our case because it&#8217;s not happening on some other projects we manage).</p>
<p>If the above story is familiar to you continue reading as this article will cover from how to detect it, to the solution that will make your cluster logs being received again.</p>
<h2>1. Symptoms</h2>
<ol style="list-style-type: none; color: #3a3a3a; font-weight: 400;">
<li style="list-style-type: none;">
<ol style="list-style-type: none; color: #3a3a3a; font-weight: 400;">
<li>&#8211; The very first symptom you may notice is the sudden, complete absence of logs in <a href="https://en.wikipedia.org/wiki/Stackdriver">Stackdriver</a>, which should be coming -as usual- from your cluster&#8217;s pods.</li>
</ol>
</li>
</ol>
<p>&nbsp;</p>
<ol style="list-style-type: none; color: #3a3a3a; font-weight: 400;">
<li>&#8211; Beside the previous fact, you will additionally find out you have no <a href="https://en.wikipedia.org/wiki/Fluentd">Fluentd</a> agents anymore in your cluster.
<div class="wp-block-codemirror-blocks code-block ">
<pre class="CodeMirror" data-setting="{">$ kubectl get daemonset -n kube-system | grep -i fluentd

</pre>
</div>
</li>
<li>&#8211; On the other hand, all the nodes of your cluster have the label <strong>beta.kubernetes.io/fluentd-ds-ready=true</strong>, which is required for the Fluentd agents to know to which nodes should be deployed.
<div class="wp-block-codemirror-blocks code-block ">
<pre class="CodeMirror" data-setting="{">$ kubectl get nodes
NAME                           STATUS   ROLES    AGE     VERSION
gke-cluster-node-93c020-7rjq   Ready    none     14h     v1.15.11-gke.15
gke-cluster-node-93c020-9w22   Ready    none     23h     v1.15.11-gke.15
gke-cluster-node-93c020-jdbt   Ready    none     47h     v1.15.11-gke.15
gke-cluster-node-93c020-jvcl   Ready    none     3h17m   v1.15.11-gke.15

$ kubectl describe node gke-cluster-node-93c020-7rjq | grep -i fluentd-ds-ready
       beta.kubernetes.io/fluentd-ds-ready=true

$ # Do the same for the remaining nodes in order to ensure all of them are properly labeled</pre>
</div>
</li>
<li>&#8211; Your GKE cluster is currently at the version v1.15 or greater.</li>
</ol>
<h2>2. Diagnose</h2>
<p>What is currently happening is GCP forcibly deprecating the legacy monitoring/logging system. The replacement is called <a href="https://cloud.google.com/stackdriver/docs/solutions/gke">Cloud Operations for GKE</a> which (for our use case) does basically the same. Once said that, keep in mind there are a few differences you should take care about when searching (such as metric names changes), and that you will find them all on the <a href="https://cloud.google.com/stackdriver/docs/solutions/gke/migration#what-is-changing">migration guide</a>.</p>
<h2>3. Treatment</h2>
<h3>Label the cluster nodes</h3>
<p>If you found on previous steps that your cluster nodes were not labeled, do it now!</p>
<div class="wp-block-codemirror-blocks code-block ">
<pre class="CodeMirror" data-setting="{">$ kubectl label node $NODE_NAME beta.kubernetes.io/fluentd-ds-ready=true</pre>
</div>
<h3>Get your cluster&#8217;s name</h3>
<p>List the available clusters.</p>
<div class="wp-block-codemirror-blocks code-block ">
<pre class="CodeMirror" data-setting="{">$ gcloud container clusters list
NAME        LOCATION        MASTER_VERSION  MASTER_IP    MACHINE_TYPE   NODE_VERSION    NUM_NODES  STATUS
my-cluster  europe-east1-a  1.15.12-gke.2   34.35.36.37  n1-standard-2  1.15.11-gke.15  4          RUNNING
</pre>
</div>
<h3>Disable the logging service for your cluster</h3>
<p>Update your cluster&#8217;s config in order to set the logging service to <em>none.</em></p>
<div class="wp-block-codemirror-blocks code-block ">
<pre class="CodeMirror" data-setting="{">$ gcloud container clusters update my-cluster --logging-service none</pre>
</div>
<h3>Enable again the logging service for your cluster</h3>
<p>Update your cluster&#8217;s config in order to set the logging service to the default one.</p>
<div class="wp-block-codemirror-blocks code-block ">
<pre class="CodeMirror" data-setting="{">$ gcloud container clusters update my-cluster --logging-service logging.googleapis.com</pre>
</div>
<p><strong>WARNING:</strong> You will get an error telling you that enabling it is not possible due to the deprecation. This is the way we finally realized where the problem was. Just move on, you are on the right way.</p>
<h3>Ensure the migration status is the expected one</h3>
<p>Open the <a href="https://console.cloud.google.com/monitoring">monitoring site at the GCP GUI</a> and then go to Settings. You will find a tab named &#8220;Kubernetes Migration Status&#8221; which should look as follows.</p>
<p><img fetchpriority="high" decoding="async" class="wp-image-2435 size-full alignnone" src="https://geko2.factoryfy.com/wp-content/uploads/kubernetes-migration-dashboard.png" alt="" width="871" height="554" /></p>
<h3>Fully enable the logging&amp;monitoring service for your cluster</h3>
<p>Open the <a href="https://console.cloud.google.com/kubernetes/list">GKE clusters list</a> and then click on the name of the cluster where you want to setup the new logging system. Once you see the cluster config, click on the EDIT button as is shown below.</p>
<p><img decoding="async" class="size-full wp-image-2437 alignnone" src="https://geko2.factoryfy.com/wp-content/uploads/edit-cluster.png" alt="" width="731" height="213" /></p>
<p>Scroll down until finding the <span class="p6n-form-label"><span class="p6n-form-label-transclude"><strong>Kubernetes Engine Monitoring</strong> setting and then select the <strong>System and workload logging and monitoring</strong> option.</span></span></p>
<p><img decoding="async" class="alignnone size-full wp-image-2439" src="https://geko2.factoryfy.com/wp-content/uploads/monitoring-dropdown.png" alt="" width="463" height="131" /></p>
<p><strong>IMPORTANT: </strong>Don&#8217;t forget to save your changes at the bottom.</p>
<h5>And that&#8217;s it! Your cluster will receive logs again as expected!</h5>
<p>&nbsp;</p>
<h2>Conclusion</h2>
<p>As you may probably know Google Cloud Platform is still in beta, so you will often find some changes breaking your already-working systems. You have two options at this point: On the one hand you could keep yourself up to date with all the future changes and deprecations. On the other hand you could just limit yourself to fix them as soon as they appear, but keep in mind you will always be blindly fighting against them.</p>
<p>There is a third option (which should be the first one), consisting on regularly coming to the <a href="https://geko.cloud/en/blog/">Geko&#8217;s blog</a> and check out if we have already dealt with the problem you are encountering. The Geko team will be always glad to see you here <img src="https://s.w.org/images/core/emoji/15.0.3/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p><a href="https://geko.cloud/en/contact/" target="_blank" rel="noopener noreferrer">Contact us for further information!</a></p>
<p>La entrada <a href="https://geko.cloud/en/gcp-gke-new-logging-system/">GCP/GKE – New logging system</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://geko.cloud/en/gcp-gke-new-logging-system/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Upgrade GKE public-cluster’s Terraform module</title>
		<link>https://geko.cloud/en/upgrade-gke-public-clusters-terraform-module/</link>
					<comments>https://geko.cloud/en/upgrade-gke-public-clusters-terraform-module/#respond</comments>
		
		<dc:creator><![CDATA[Jose Luis Sánchez]]></dc:creator>
		<pubDate>Wed, 13 May 2020 06:24:40 +0000</pubDate>
				<category><![CDATA[News]]></category>
		<category><![CDATA[GKE]]></category>
		<category><![CDATA[Google Cloud]]></category>
		<category><![CDATA[Terraform]]></category>
		<guid isPermaLink="false">https://geko2.factoryfy.com/upgrade-gke-public-clusters-terraform-module/</guid>

					<description><![CDATA[<p>Introduction From time to time Google introduces new features and changes that sometimes also force the Terraform modules to upgrade themselves. It was our case at Geko, where we were using the GKE module for public-cluster deployment&#38;management at version 5.x. A few days ago, when we planned to update some parameters it came that Google [&#8230;]</p>
<p>La entrada <a href="https://geko.cloud/en/upgrade-gke-public-clusters-terraform-module/">Upgrade GKE public-cluster’s Terraform module</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h3>Introduction</h3>
<p>From time to time Google introduces new features and changes that sometimes also force the <a href="https://www.terraform.io/docs/configuration/modules.html">Terraform modules</a> to upgrade themselves. It was our case at <a href="https://geko2.factoryfy.com/">Geko</a>, where we were using the <a href="https://registry.terraform.io/modules/terraform-google-modules/kubernetes-engine/google/5.1.1/submodules/beta-public-cluster">GKE module for public-cluster deployment&amp;management at version 5.x</a>. A few days ago, when we planned to update some parameters it came that Google had removed the support for the Kubernetes dashboard. It was completely deprecated and the module was failing because of it, so we were forced to upgrade the module in order to meet the new conditions. There were up to 3 major version upgrades available, so we decided to go for it and use the latest one. However, it was not a standalone solution as it required to handle Terraform state&#8217;s incoherences.</p>
<p>The aim of this lab is to learn how to <strong>upgrade</strong> the official <strong>Terraform module</strong> intended to deploy&amp;manage a <strong>public GKE cluster</strong>. We will specially deal with module&#8217;s (<a href="https://registry.terraform.io/modules/terraform-google-modules/kubernetes-engine/google/8.1.0/submodules/beta-public-cluster">kubernetes-engine.beta-public-cluster</a>) breaking changes, and we will manage to obtain the consistent status we previously had before the failure which preceded the upgrade.</p>
<p><strong>Estimated time to finish this lab</strong>: ~20 minutes</p>
<h3>1. Remove the previous resources</h3>
<p><strong>It&#8217;s strongly encouraged to perform a <em>tfstate</em> file backup before continue!</strong></p>
<p>It&#8217;s especially important to remove all the conflicting resources from the Terraform state as soon as they are bounded between them using dependencies. The goal here is to remove any deprecated binding prior to importing them again from the current &#8220;picture&#8221; there&#8217;s already deployed.</p>
<p>The main components on a Kubernetes cluster are the networks (and subnetworks), the node pool and the cluster itself. Let&#8217;s focus on them.</p>
<div class="wp-block-codemirror-blocks code-block">
<pre class="CodeMirror" data-setting="{">terraform state rm module.gke.google_container_cluster.primary
terraform state rm module.gke.google_container_node_pool.pools[0]
terraform state rm module.vpc.google_compute_network.network
terraform state rm module.vpc.google_compute_subnetwork.subnetwork[0]
terraform state rm module.vpc.google_compute_subnetwork.subnetwork[1]</pre>
</div>
<h3>2. Upgrade versions</h3>
<p>Once removed the previous states the next step is to set the version for the required modules to the current latest version. For the GKE module the latest now it&#8217;s 8.1.0, but it will be allowed to automatically adopt minor upgrades (&#8220;~&gt;&#8221;).</p>
<h5>Upgrade the GKE cluster module</h5>
<div class="wp-block-codemirror-blocks code-block ">
<pre class="CodeMirror" data-setting="{"> module "gke" {
   source  = "terraform-google-modules/kubernetes-engine/google//modules/beta-public-cluster"
-  version = "~&gt; 5.0"
+  version = "~&gt; 8.1"
</pre>
</div>
<h5>Upgrade the VPC module</h5>
<div class="wp-block-codemirror-blocks code-block ">
<pre class="CodeMirror" data-setting="{"> module "vpc" {
-  source  = "github.com/terraform-google-modules/terraform-google-network?ref=v1.1.0"
+  source  = "github.com/terraform-google-modules/terraform-google-network?ref=v2.3.0"</pre>
</div>
<h5>Check the new resources</h5>
<p>In order to find out if the new resources have experienced a name change (due to the modules upgrade), a <a href="https://www.terraform.io/docs/commands/plan.html"><strong>Terraform plan</strong></a> is strongly encouraged.</p>
<p>On this case it has been found that some module&#8217;s internal hierarchy and also list&#8217;s indexes have changed.</p>
<div class="wp-block-codemirror-blocks code-block">
<pre class="CodeMirror" data-setting="{">  module.gke.google_container_cluster.primary
  
<b>-</b> module.gke.google_container_node_pool.pools[0]
<b>+</b> module.gke.google_container_node_pool.pools["default-node-pool"]

  module.vpc.google_compute_network.network
  
<b>-</b> module.vpc.google_compute_subnetwork.subnetwork[0]
<b>+</b> module.vpc.module.subnets.google_compute_subnetwork.subnetwork["southamerica-east1/my-cluster-public"]

<b>-</b> module.vpc.google_compute_subnetwork.subnetwork[1]
<b>+</b> module.vpc.module.subnets.google_compute_subnetwork.subnetwork["southamerica-east1/my-cluster-private"]</pre>
</div>
<h3>3. Import fresh resources</h3>
<p>Keep in mind that the zone/region depends on your kind of cluster. If it&#8217;s zonal you must use the master zone (e.g. <em>southamerica-east1-a</em>). On the other hand, if it&#8217;s a regional cluster you must use the region (e.g. <em>southamerica-east1</em>). The following example assumes a regional cluster located at <em>southamerica-east1</em>, in the project &#8220;<strong>my-project</strong>&#8220;, and with a cluster name &#8220;<strong>my-cluster</strong>&#8220;. The network names were set accordingly to the cluster&#8217;s name, just adding the suffixes &#8220;private&#8221; and &#8220;public&#8221; to the subnets to properly differentiate them.</p>
<p><strong>Note also the new module hierarchy and indexing.</strong></p>
<div class="wp-block-codemirror-blocks code-block ">
<pre class="CodeMirror" data-setting="{"># Global vars
REGION="southamerica-east1"
PROJECT="my-project"
CLUSTER="my-cluster"

# Cluster
CLUSTER_LOCAL="module.gke.google_container_cluster.primary"
CLUSTER_REMOTE="${PROJECT}/${REGION}/${CLUSTER}"
terraform import $CLUSTER_LOCAL $CLUSTER_REMOTE

# Node pool
POOL_LOCAL="module.gke.google_container_node_pool.pools["default-node-pool"]"
POOL_REMOTE="${CLUSTER_REMOTE}/default-node-pool"
terraform import $POOL_LOCAL $POOL_REMOTE

# Subnetworks
BASE_SUBNET_LOCAL="module.vpc.module.subnets.google_compute_subnetwork.subnetwork"

## Public
PUBLIC_SUBNET_LOCAL="${BASE_SUBNET_LOCAL}["${REGION}/${CLUSTER}-public"]"
PUBLIC_SUBNET_REMOTE="${CLUSTER_REMOTE}-public"
terraform import $PUBLIC_SUBNET_LOCAL $PUBLIC_SUBNET_REMOTE

## Private
PRIVATE_SUBNET_LOCAL="${BASE_SUBNET_LOCAL}["${REGION}/${CLUSTER}-private"]"
PRIVATE_SUBNET_REMOTE="${CLUSTER_REMOTE}-private"
terraform import $PRIVATE_SUBNET_LOCAL $PRIVATE_SUBNET_REMOTE

# Network
NETWORK_LOCAL="module.vpc.module.vpc.google_compute_network.network"
NETWORK_REMOTE="${PROJECT}/${CLUSTER}"
terraform import $NETWORK_LOCAL $NETWORK_REMOTE</pre>
</div>
<h3> 4. Update parameters</h3>
<p>It&#8217;s very likely you will encounter that after a Terraform plan the <strong><em>google_container_cluster</em> </strong>resource still needs to be updated due to a <em>subnetwork</em> parameter change. The new subnet keys have made the indexes to change their order. Just edit your GKE module to replace the <em>subnetwork</em> parameter as below.</p>
<div class="wp-block-codemirror-blocks code-block ">
<pre class="CodeMirror" data-setting="{"><b>-</b> subnetwork = module.vpc.subnets_names[<b>0</b>]
<b>+</b> subnetwork = module.vpc.subnets_names[<b>1</b>]</pre>
</div>
<h3>Conclusion</h3>
<p>As you may have read above, sometimes -when relying on third parties- could happen that a breaking change is introduced and you get yourself into troubles to get the service back again. Beside this, the solution could introduce collateral damages which will require additional sub-solutions. On this particular case regarding Terraform, dealing with inconsistent states is not really common nor recommended, but it comes that is the only method you have available to solve them on your tool-set.</p>
<hr />
<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. <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>
<p>See you on the next post!</p>
<p>La entrada <a href="https://geko.cloud/en/upgrade-gke-public-clusters-terraform-module/">Upgrade GKE public-cluster’s Terraform module</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://geko.cloud/en/upgrade-gke-public-clusters-terraform-module/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
