<?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>UX Techno</title>
	<atom:link href="https://linuxroutes.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://linuxroutes.com/</link>
	<description>Platform for learning UNIX &#38; LINUX technologies</description>
	<lastBuildDate>Tue, 25 Oct 2022 06:10:18 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.5</generator>

<image>
	<url>https://linuxroutes.com/wp-content/uploads/2016/12/cropped-uxtechno-32x32.jpg</url>
	<title>UX Techno</title>
	<link>https://linuxroutes.com/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to configure Azure blob storage as sftp server</title>
		<link>https://linuxroutes.com/how-to-configure-azure-blob-storage-as-sftp-server/</link>
					<comments>https://linuxroutes.com/how-to-configure-azure-blob-storage-as-sftp-server/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 25 Oct 2022 06:10:18 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://linuxroutes.com/?p=3978</guid>

					<description><![CDATA[<p>In this article we are going to discuss how to configure Azure blob storage as sftp server.</p>
<p>The post <a href="https://linuxroutes.com/how-to-configure-azure-blob-storage-as-sftp-server/">How to configure Azure blob storage as sftp server</a> appeared first on <a href="https://linuxroutes.com">UX Techno</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><a href="https://linuxroutes.com/wp-content/uploads/2022/10/How-to-configure-Azure-blob-storage-as-sftp-server.png"><img decoding="async" class="alignright wp-image-4029 size-thumbnail" src="https://linuxroutes.com/wp-content/uploads/2022/10/How-to-configure-Azure-blob-storage-as-sftp-server-80x80.png" alt="How to configure Azure blob storage as sftp server" width="80" height="80" srcset="https://linuxroutes.com/wp-content/uploads/2022/10/How-to-configure-Azure-blob-storage-as-sftp-server-80x80.png 80w, https://linuxroutes.com/wp-content/uploads/2022/10/How-to-configure-Azure-blob-storage-as-sftp-server-100x100.png 100w" sizes="(max-width: 80px) 100vw, 80px" /></a></p>
<p>In this article we are going to discuss how to configure Azure blob storage as sftp server. Knowing the fact that Azure blob is used as a massively scalable and secure object storage for cloud-native workloads. To check more details about the Azure Blob kindly check this <a href="https://azure.microsoft.com/en-us/products/storage/blobs/" target="_blank" rel="noopener">URL</a>.</p>
<p>Following are the steps we need to follow in order to configure Azure blob storage as sftp server.</p>
<p>1.Create storage account:First of all you need to have the storage account. If not you can create the new storage account. To create the storage account click on the &#8220;<strong>Microsoft Azure</strong>&#8221; on the top left corner once you logged into Azure portal.  Then click on the &#8220;Create a resource&#8221; (with + sign) link.</p>
<p><a href="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.23.11-PM.png"><img fetchpriority="high" decoding="async" class="wp-image-3982 size-medium aligncenter" src="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.23.11-PM-300x180.png" alt="configure Azure blob storage as sftp server" width="300" height="180" srcset="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.23.11-PM-300x180.png 300w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.23.11-PM.png 762w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>2. In the next window type &#8220;storage account&#8221; and select the Storage account option to go ahead.</p>
<p><a href="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.28.45-PM.png"><img decoding="async" class="aligncenter wp-image-3984" src="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.28.45-PM-300x115.png" alt="configure Azure blob storage as sftp server" width="500" height="192" srcset="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.28.45-PM-300x115.png 300w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.28.45-PM-1030x395.png 1030w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.28.45-PM-768x294.png 768w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.28.45-PM.png 1420w" sizes="(max-width: 500px) 100vw, 500px" /></a></p>
<p>3.  In the next window click on the &#8220;Create&#8221; button selecting &#8220;Storage account&#8221; option as below:</p>
<p><a href="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.33.51-PM.png"><img loading="lazy" decoding="async" class="wp-image-3987 aligncenter" src="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.33.51-PM-1030x491.png" alt="configure Azure blob storage as sftp server" width="500" height="238" srcset="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.33.51-PM-1030x491.png 1030w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.33.51-PM-300x143.png 300w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.33.51-PM-768x366.png 768w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.33.51-PM.png 1434w" sizes="auto, (max-width: 500px) 100vw, 500px" /></a></p>
<p>4. In the next window select &#8220;Subscription&#8221; &amp; &#8220;Resource group&#8221; as per your azure account. Then give proper name to your storage account. In my demo I have used &#8220;mylraccount&#8221; as below in the screenshot. Also select proper region as per your requirement under region option.</p>
<p><a href="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.39.56-PM.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-3989" src="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.39.56-PM-1030x726.png" alt="" width="1030" height="726" srcset="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.39.56-PM-1030x726.png 1030w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.39.56-PM-300x211.png 300w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.39.56-PM-768x541.png 768w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.39.56-PM-1536x1082.png 1536w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.39.56-PM.png 1964w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></p>
<p>5. In the Advanced tab tick mark the option &#8220;<strong>Enable hierarchical namespace</strong>&#8221; and also tick mark the &#8220;<strong>Enable SFTP</strong>&#8221; and &#8220;<strong>Enable network file system v3</strong>&#8221; Option. This selection necessary to configure Azure blob storage as sftp server.</p>
<p><a href="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.44.48-PM.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-3991" src="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.44.48-PM-1030x726.png" alt="configure Azure blob storage as sftp server" width="1030" height="726" srcset="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.44.48-PM-1030x726.png 1030w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.44.48-PM-300x211.png 300w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.44.48-PM-768x541.png 768w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.44.48-PM-1536x1082.png 1536w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.44.48-PM.png 1964w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></p>
<div class="infoBalloonStyles-92">6, Keep all the other options as default and click on the review button. Once review is completed click on the Create button.</div>
<div><a href="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.48.25-PM.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-3993" src="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.48.25-PM-1030x726.png" alt="" width="1030" height="726" srcset="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.48.25-PM-1030x726.png 1030w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.48.25-PM-300x211.png 300w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.48.25-PM-768x541.png 768w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.48.25-PM-1536x1082.png 1536w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.48.25-PM.png 1964w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></div>
<div></div>
<div>7.  System will respond with deployment progress message as below if everything goes fine.</div>
<div><a href="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.49.57-PM.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-3995" src="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.49.57-PM-1030x637.png" alt="configure Azure blob storage as sftp server" width="1030" height="637" srcset="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.49.57-PM-1030x637.png 1030w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.49.57-PM-300x186.png 300w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.49.57-PM-768x475.png 768w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.49.57-PM-1536x951.png 1536w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.49.57-PM-2048x1267.png 2048w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></div>
<div>8. After deployment is completed click on the &#8220;Go to resource&#8221; button.</div>
<div><a href="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.53.04-PM.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-3997" src="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.53.04-PM-1030x637.png" alt="" width="1030" height="637" srcset="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.53.04-PM-1030x637.png 1030w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.53.04-PM-300x186.png 300w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.53.04-PM-768x475.png 768w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.53.04-PM-1536x951.png 1536w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.53.04-PM-2048x1267.png 2048w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></div>
<div>9. In the next step select &#8220;<strong>Containers</strong>&#8221; under Data Storage in the left pane.</div>
<div><a href="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.55.41-PM.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-3999" src="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.55.41-PM-1030x637.png" alt="" width="1030" height="637" srcset="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.55.41-PM-1030x637.png 1030w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.55.41-PM-300x186.png 300w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.55.41-PM-768x475.png 768w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.55.41-PM-1536x951.png 1536w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.55.41-PM-2048x1267.png 2048w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></div>
<div>10. In the window click on the &#8220;+ container&#8221; option to create the container. Here container is nothing but the directory under which you are placing the objects or another directories.</div>
<div><a href="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.59.33-PM.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-4001" src="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.59.33-PM-1030x637.png" alt="" width="1030" height="637" srcset="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.59.33-PM-1030x637.png 1030w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.59.33-PM-300x186.png 300w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.59.33-PM-768x475.png 768w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.59.33-PM-1536x951.png 1536w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-7.59.33-PM-2048x1267.png 2048w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></div>
<div>11. Now give it a name to your container , Here i gave mydata as a name &amp; click on create button.</div>
<div><a href="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.02.39-PM.png"><img loading="lazy" decoding="async" class="alignnone wp-image-4003 size-large" src="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.02.39-PM-498x1030.png" alt="configure Azure blob storage as sftp server" width="498" height="1030" srcset="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.02.39-PM-498x1030.png 498w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.02.39-PM-145x300.png 145w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.02.39-PM.png 640w" sizes="auto, (max-width: 498px) 100vw, 498px" /></a></div>
<div>You will see that &#8220;mydata&#8221; container got created as a result.</div>
<div><a href="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.06.33-PM.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-4006" src="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.06.33-PM-1030x469.png" alt="" width="1030" height="469" srcset="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.06.33-PM-1030x469.png 1030w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.06.33-PM-300x137.png 300w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.06.33-PM-768x350.png 768w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.06.33-PM-1536x700.png 1536w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.06.33-PM-2048x933.png 2048w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></div>
<div></div>
<div>12. For the next step select &#8220;<strong>SFTP</strong>&#8221; option under <strong>settings </strong>menu and click on the &#8220;Add local user&#8221; option as below:</div>
<div><a href="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.10.22-PM-1.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-4008" src="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.10.22-PM-1-1030x469.png" alt="" width="1030" height="469" srcset="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.10.22-PM-1-1030x469.png 1030w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.10.22-PM-1-300x137.png 300w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.10.22-PM-1-768x350.png 768w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.10.22-PM-1-1536x700.png 1536w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.10.22-PM-1-2048x933.png 2048w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></div>
<div></div>
<div>13. In the next step give the name to user . I am using demouser and select option SSH Password and click on the next button.</div>
<div><a href="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.12.43-PM.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-4010" src="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.12.43-PM-1030x785.png" alt="" width="1030" height="785" srcset="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.12.43-PM-1030x785.png 1030w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.12.43-PM-300x229.png 300w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.12.43-PM-768x585.png 768w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.12.43-PM-1536x1171.png 1536w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.12.43-PM.png 1708w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></div>
<div>Under Container permissions options select the container &#8220;mydata&#8221; which we have created in the earlier step and select required permission as per your need and click on the &#8220;Add&#8221; button.</div>
<div><a href="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.16.48-PM.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-4011" src="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.16.48-PM-1030x785.png" alt="" width="1030" height="785" srcset="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.16.48-PM-1030x785.png 1030w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.16.48-PM-300x229.png 300w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.16.48-PM-768x585.png 768w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.16.48-PM-1536x1171.png 1536w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.16.48-PM.png 1708w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></div>
<div></div>
<div>14. In the next step system will respond with password. Copy this to your safe location.</div>
<div><a href="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.19.06-PM.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-4013" src="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.19.06-PM-1030x785.png" alt="" width="1030" height="785" srcset="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.19.06-PM-1030x785.png 1030w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.19.06-PM-300x229.png 300w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.19.06-PM-768x585.png 768w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.19.06-PM-1536x1171.png 1536w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.19.06-PM.png 1708w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></div>
<div>15. In the next step copy the connection string by clicking copy option available next to string under &#8220;Connection string&#8221;</div>
<div></div>
<div><a href="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.22.33-PM-1.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-4015" src="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.22.33-PM-1-1030x285.png" alt="configure Azure blob storage as sftp server" width="1030" height="285" srcset="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.22.33-PM-1-1030x285.png 1030w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.22.33-PM-1-300x83.png 300w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.22.33-PM-1-768x212.png 768w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.22.33-PM-1-1536x425.png 1536w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.22.33-PM-1-2048x566.png 2048w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></div>
<div>16. Now to configure security rule click on the &#8220;<strong>Networking</strong>&#8221; option available under &#8220;<strong>Security + networking</strong>&#8220;. Then under Firewall you can select &#8220;<strong>Add your client IP address</strong>&#8221; or you can add additional IP&#8217;s to open up the connection from the. internet in the &#8220;<strong>Address range</strong>&#8221; box. After all IP&#8217;s added click on the save button to save the configuration from the top.</div>
<div><a href="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.26.27-PM.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-4017" src="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.26.27-PM-1030x556.png" alt="configure Azure blob storage as sftp server" width="1030" height="556" srcset="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.26.27-PM-1030x556.png 1030w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.26.27-PM-300x162.png 300w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.26.27-PM-768x415.png 768w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.26.27-PM-1536x829.png 1536w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.26.27-PM-2048x1106.png 2048w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></div>
<div>17. Now it&#8217;s time to connect to our sftp server. To connect the sftp server you need the connection string we captured in the 15 th step:</div>
<div></div>
<div>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">mylraccount.&lt;CONTAINER_NAME&gt;.demouser@mylraccount.blob.core.windows.net</pre>
<p>In the above string replace the &#8220;<strong>CONTAINER_NAME</strong>&#8221; with &#8220;<strong>mydata</strong>&#8221; which is our container name so our connection string will be &#8220;<strong>mylraccount.mydata.demouser@mylraccount.blob.core.windows.net</strong>&#8221;</p>
</div>
<p>try connect with sftp client :</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">(base) ➜  ~ sftp mylraccount.mydata.demouser@mylraccount.blob.core.windows.net
The authenticity of host 'mylraccount.blob.core.windows.net (20.209.0.229)' can't be established.
ECDSA key fingerprint is SHA256:ixDeCdmQOB9ROqdJiVdXyFVsRqLmJJUb2M4shrWj8gI.
This host key is known by the following other names/addresses:
    ~/.ssh/known_hosts:22: mylrstorageacct1121.blob.core.windows.net
    ~/.ssh/known_hosts:23: mylrstorage.blob.core.windows.net
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'mylraccount.blob.core.windows.net' (ECDSA) to the list of known hosts.
mylraccount.mydata.demouser@mylraccount.blob.core.windows.net's password: 
Connected to mylraccount.blob.core.windows.net.
sftp&gt; 

</pre>
<p>when prompted select yes for &#8220;<strong>Are you sure you want to continue connecting</strong>&#8221; and enter the password captured in the step 14.  For testing i have just upload sample file named &#8220;<span class="s1">untitled.txt</span>&#8220;.</p>
<p><a href="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.42.06-PM.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-4021" src="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.42.06-PM-1030x443.png" alt="" width="1030" height="443" srcset="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.42.06-PM-1030x443.png 1030w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.42.06-PM-300x129.png 300w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.42.06-PM-768x331.png 768w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.42.06-PM-1536x661.png 1536w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.42.06-PM.png 1714w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">Connected to mylraccount.blob.core.windows.net.
sftp&gt; put untitled.txt
Uploading untitled.txt to /untitled.txt
untitled.txt                                                                           100%    0     0.0KB/s   00:00    
sftp&gt; 
</pre>
<p>You can see that uploaded &#8220;<span class="s1">untitled.txt</span>&#8221; in our mydata container.</p>
<p>&nbsp;</p>
<p><a href="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.40.49-PM.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-4020" src="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.40.49-PM-1030x556.png" alt="configure Azure blob storage as sftp server" width="1030" height="556" srcset="https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.40.49-PM-1030x556.png 1030w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.40.49-PM-300x162.png 300w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.40.49-PM-768x415.png 768w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.40.49-PM-1536x829.png 1536w, https://linuxroutes.com/wp-content/uploads/2022/10/Screenshot-2022-10-24-at-8.40.49-PM-2048x1106.png 2048w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></p>
<p>So this how we can configure Azure blob storage as sftp server.</p>
<p>The post <a href="https://linuxroutes.com/how-to-configure-azure-blob-storage-as-sftp-server/">How to configure Azure blob storage as sftp server</a> appeared first on <a href="https://linuxroutes.com">UX Techno</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://linuxroutes.com/how-to-configure-azure-blob-storage-as-sftp-server/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to draw scatter plot using Plotly library in Python.</title>
		<link>https://linuxroutes.com/how-to-draw-scatter-plot-using-plotly-library-in-python/</link>
					<comments>https://linuxroutes.com/how-to-draw-scatter-plot-using-plotly-library-in-python/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 15 Aug 2022 13:47:31 +0000</pubDate>
				<category><![CDATA[devops]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[plotly]]></category>
		<category><![CDATA[python]]></category>
		<guid isPermaLink="false">https://linuxroutes.com/?p=3958</guid>

					<description><![CDATA[<p>In this post we are going to learn how to use scatter plot using Plotly library in Python.</p>
<p>The post <a href="https://linuxroutes.com/how-to-draw-scatter-plot-using-plotly-library-in-python/">How to draw scatter plot using Plotly library in Python.</a> appeared first on <a href="https://linuxroutes.com">UX Techno</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Plotly is the library using which we can generate the interactive graphs which are good visualisation. Using this visualisation we can draw some conclusion or it will make us easy to conclude something by looking at the chart or graphs. In the normal scenario it becomes really difficult to arrive at the decision simply looking at data values.</p>
<p>In this post we are going to learn how to use scatter plot using Plotly library in Python.</p>
<p>The data points  we are going to fetch from the API. Here the API link is &#8220;<a href="https://covid19-mohfw.herokuapp.com/" target="_blank" rel="noopener">https://covid19-mohfw.herokuapp.com/</a>&#8220;. This API  is the public API for COVID-19 cases in India, updated directly from MOHFW website. So using this data we are going to plot state wise data for deaths and cases.</p>
<p>In this post we are going to plot bubble chart,  which helps to displays multiple circles (bubbles) in a 2D plot as same in scatter plot.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="atomic">import pandas as pd
import plotly.express as px
import requests

response = requests.get("https://covid19-mohfw.herokuapp.com/")

data=response.json()
df=pd.json_normalize(data['states'])
fig = px.scatter(df, x="deaths",y="cases",size="deaths", color="state",log_x=True, size_max=60)

fig.show()
print(df)</pre>
<p>Here is the Output of the above code:</p>
<p><a href="https://linuxroutes.com/wp-content/uploads/2022/08/newplot-1.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-3969" src="https://linuxroutes.com/wp-content/uploads/2022/08/newplot-1-1030x410.png" alt="" width="1030" height="410" srcset="https://linuxroutes.com/wp-content/uploads/2022/08/newplot-1-1030x410.png 1030w, https://linuxroutes.com/wp-content/uploads/2022/08/newplot-1-300x119.png 300w, https://linuxroutes.com/wp-content/uploads/2022/08/newplot-1-768x306.png 768w, https://linuxroutes.com/wp-content/uploads/2022/08/newplot-1.png 1318w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></p>
<p>Please check this <a href="https://github.com/manmohanmirkar123/plotting/blob/main/plot.ipynb" target="_blank" rel="noopener">link</a> for the Jupyter notebook.</p>
<p>The post <a href="https://linuxroutes.com/how-to-draw-scatter-plot-using-plotly-library-in-python/">How to draw scatter plot using Plotly library in Python.</a> appeared first on <a href="https://linuxroutes.com">UX Techno</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://linuxroutes.com/how-to-draw-scatter-plot-using-plotly-library-in-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Create simple API using FastAPI in Python</title>
		<link>https://linuxroutes.com/how-to-create-simple-api-using-fastapi-in-python/</link>
					<comments>https://linuxroutes.com/how-to-create-simple-api-using-fastapi-in-python/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 20 Nov 2021 16:45:13 +0000</pubDate>
				<category><![CDATA[devops]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[fastapi]]></category>
		<category><![CDATA[python]]></category>
		<guid isPermaLink="false">https://linuxroutes.com/?p=3891</guid>

					<description><![CDATA[<p>This article will teach you about how to create simple API using FastAPI in python.</p>
<p>The post <a href="https://linuxroutes.com/how-to-create-simple-api-using-fastapi-in-python/">How to Create simple API using FastAPI in Python</a> appeared first on <a href="https://linuxroutes.com">UX Techno</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Nowadays the whole world revolves around API. So get into the API world today I am going to explain to you &#8220;How to Create simple API using FastAPI in Python&#8221;.</p>
<h2>About FastAPI:</h2>
<p>FastAPI is a framework written in Python 3. FastAPI also gives you the flexibility to provide you Swagger UI documentation which helps you if you are working in a multimember team or to give it a front-end team.  Also, you don&#8217;t need a tool like Postman to test your API. It&#8217;s really easy to code your API if you know a little bit about Python. To check more details on the same please check this <a href="https://fastapi.tiangolo.com/" target="_blank" rel="noopener">link</a></p>
<h2>Pre-requisite for FastAPI</h2>
<ul>
<li>Python 3.6+</li>
<li>FastAPI module (Can be installed using pip3)</li>
<li>Uvicorn (webserver hosting the api in your system. This also can be istalled using pip3)</li>
<li>Editor (vs Code)</li>
</ul>
<h3>Steps to Create simple API using FastAPI in Python</h3>
<ol>
<li>Install Python 3.6+. Please follow this <a href="https://phoenixnap.com/kb/how-to-install-python-3-windows">link</a> to complete this. Make sure you install versions greater than 3.6.</li>
<li>Create a Virtual environment using the below command:</li>
</ol>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">python3 -m venv myfastapienv</pre>
<p>The above command creates the subdirectory called mysfastapinv which is the name we gave to our virtual environment.</p>
<p>Activate the virtual environment.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">C:\FastAPI&gt; .\myfastapienv\Scripts\activate

(myfastapienv) C:\FastAPI&gt;
</pre>
<p>Now you will see that our virtual environment is activated as shown above.</p>
<h3>Install fastapi and uvicorn.</h3>
<ol>
<li>Install the FastAPI and Uvicorn which will be the web server for the FastAPI using the below command:</li>
</ol>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">(myfastapienv) C:\FastAPI&gt;pip3 install fastapi uvicorn</pre>
<p>2. Now we will create the sample python script with .py extension. in the &#8220;/myfastapienv/Scripts&#8221; location called <strong>main.py </strong>as below:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def baseurl():
    return {"Hello from Base PATH"}

@app.get("/hello")
def baseurl():
    return {"Hello from /hello PATH"}

@app.get('/user/{name}')
def show(name: str):
    return {f"Hello from the /user PATH {name}"}</pre>
<p>Following is a description of the code:</p>
<p><strong>Line 1:</strong> At line 1 we imported FastAPI library</p>
<p><strong>Line 3:</strong> At line 3 we created one instance of the FastAPI class called &#8220;app&#8221;. This name can be anything.</p>
<p><strong>Line 5-7:</strong> Between the line 5-7 we define the PATH and respective function to be called which simply returns<strong> <span class="enlighter-s0">&#8220;Hello from Base PATH&#8221;</span></strong> message.  This request is of the type &#8220;GET&#8221;. This is the default PATH of our API.</p>
<p><strong>Line 9-11: </strong>Between the line 9-11 we define the PATH and respective function to be called which simply returns<span class="enlighter-s0">&#8220;Hello from /hello PATH&#8221;</span> message.  This request is of the type &#8220;GET&#8221;.</p>
<p><strong>Line 13-15: </strong>Between the line 13-15 we define the PATH and respective function to be called which simply returns <span class="enlighter-text">f</span><span class="enlighter-s0">&#8220;Hello from the /user PATH {name}&#8221;</span> message.  This request is of the type &#8220;GET&#8221;. Here we passing the name variable and printing the Hello message to that user.</p>
<h3>Start the uvicorn webserver:</h3>
<p>Once you save the file at the command prompt use the below command to start the uvincorn webserver. Here we have used reload parameter so that we don&#8217;t have to restart the web server every time we save the main.py file.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">(myfastapienv) C:\FastAPI\myfastapienv\Scripts&gt;uvicorn main:app --reload
</pre>
<p>If you look at line 1 we are using main parameter since we are using &#8220;main.py&#8221; in our demo and &#8220;app&#8221; parameter since its the name of the instance we created in the main.py file(check line 3 from the code)</p>
<p>Log snippet:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">(myfastapienv) C:\FastAPI\myfastapienv\Scripts&gt;uvicorn main:app --reload
←[32mINFO←[0m:     Will watch for changes in these directories: ['C:\\FastAPI\\myfastapienv\\Scripts']
←[32mINFO←[0m:     Uvicorn running on ←[1mhttp://127.0.0.1:8000←[0m (Press CTRL+C to quit)
←[32mINFO←[0m:     Started reloader process [←[36m←[1m3396←[0m] using ←[36m←[1mstatreload←[0m
←[32mINFO←[0m:     Started server process [←[36m1584←[0m]
←[32mINFO←[0m:     Waiting for application startup.
←[32mINFO←[0m:     Application startup complete.</pre>
<p>If you check the above logs our API URL is <strong>&#8220;http://localhost:8000&#8221;</strong></p>
<p>Now let&#8217;s just access the following URL to check if everything is working is fine or not.</p>
<p><strong>Base URL 1:</strong> http://localhost:8000/</p>
<p><a href="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python.png"><img loading="lazy" decoding="async" class="wp-image-3918 alignnone" src="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python.png" alt="Create simple API using FastAPI in Python" width="479" height="101" srcset="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python.png 688w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python-300x63.png 300w" sizes="auto, (max-width: 479px) 100vw, 479px" /></a></p>
<p><strong>hello URL 2:</strong> http://localhost:8000/hello</p>
<p><a href="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python1.png"><img loading="lazy" decoding="async" class="alignnone wp-image-3921 size-full" src="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python1.png" alt="Create simple API using FastAPI in Python" width="467" height="117" srcset="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python1.png 467w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python1-300x75.png 300w" sizes="auto, (max-width: 467px) 100vw, 467px" /></a></p>
<p><strong>user URL 3:</strong> http://localhost:8000/user/Manmohan</p>
<p>Please note here parameter Manmohan can be replaced with any name. Our API will print out Hello message accordingly.</p>
<p><a href="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python2.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3926" src="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python2.png" alt="Create simple API using FastAPI in Python" width="610" height="148" srcset="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python2.png 610w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python2-300x73.png 300w" sizes="auto, (max-width: 610px) 100vw, 610px" /></a></p>
<p><strong>OR</strong> http://localhost:8000/user/Linuxroutes</p>
<p><a href="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python3.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3928" src="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python3.png" alt="Create simple API using FastAPI in Python" width="585" height="141" srcset="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python3.png 585w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python3-300x72.png 300w" sizes="auto, (max-width: 585px) 100vw, 585px" /></a></p>
<h3><strong>Swagger UI: </strong></h3>
<p>Another nice feature of FastAPI is Swagger UI. This means FastAPI gives us nice documentation about the API created automatically. To access the Swagger UI simply append /docs to your main URL of the API. In our case it is &#8220;http://localhost:8000/docs&#8221;</p>
<p><a href="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python4.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-3931" src="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python4-1030x486.png" alt="Create simple API using FastAPI in Python" width="1030" height="486" srcset="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python4-1030x486.png 1030w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python4-300x141.png 300w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python4-768x362.png 768w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python4-1536x724.png 1536w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python4.png 1868w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></p>
<p>If you look at above screenshot it mentioned about three PATHs which are of the type GET. Also if you click down arrow given at right side of each PATH you will come to know more details such as mandatory field and field type etc. as below:</p>
<p><a href="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python5.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-3933" src="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python5-1030x523.png" alt="Create simple API using FastAPI in Python" width="1030" height="523" srcset="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python5-1030x523.png 1030w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python5-300x152.png 300w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python5-768x390.png 768w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python5-1536x780.png 1536w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python5.png 1853w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></p>
<p>In case you want to pass some parameters to the API simply click on &#8220;Try out&#8221; button. and enter the parameter value as below:</p>
<p><a href="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python6.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-3935" src="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python6-1030x315.png" alt="Create simple API using FastAPI in Python" width="1030" height="315" srcset="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python6-1030x315.png 1030w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python6-300x92.png 300w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python6-768x235.png 768w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python6-1536x469.png 1536w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python6.png 1870w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></p>
<p>Once you click on Execute button you will get the response from the API as below:</p>
<p><a href="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python7.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-3937" src="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python7-1030x599.png" alt="Create simple API using FastAPI in Python" width="1030" height="599" srcset="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python7-1030x599.png 1030w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python7-300x175.png 300w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python7-768x447.png 768w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python7-1536x894.png 1536w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python7.png 1677w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></p>
<p>Because of this you don&#8217;t need another tool such as Postman to test your API. There is also another type of API documentation available with FastAPI which is called <strong>&#8220;redoc&#8221;.</strong> To access this documentation simply add the keyword &#8220;redoc&#8221; to your base API URL. In our case its &#8220;http://localhost:8000/redoc&#8221; . This looks as below:</p>
<p><a href="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python8.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-3939" src="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python8-1030x533.png" alt="Create simple API using FastAPI in Python" width="1030" height="533" srcset="https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python8-1030x533.png 1030w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python8-300x155.png 300w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python8-768x397.png 768w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python8-1536x794.png 1536w, https://linuxroutes.com/wp-content/uploads/2021/11/Create-simple-API-using-FastAPI-in-Python8.png 1885w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></a></p>
<p>&nbsp;</p>
<p>So this is all about &#8220;Create simple API using FastAPI in Python&#8221;.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a href="https://linuxroutes.com/how-to-create-simple-api-using-fastapi-in-python/">How to Create simple API using FastAPI in Python</a> appeared first on <a href="https://linuxroutes.com">UX Techno</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://linuxroutes.com/how-to-create-simple-api-using-fastapi-in-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to drain node in Kubernetes cluster for maintenance activity.</title>
		<link>https://linuxroutes.com/how-to-drain-node-in-kubernetes-cluster-for-maintenance-activity/</link>
					<comments>https://linuxroutes.com/how-to-drain-node-in-kubernetes-cluster-for-maintenance-activity/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 05 Dec 2020 07:08:42 +0000</pubDate>
				<category><![CDATA[devops]]></category>
		<category><![CDATA[Kubernetes]]></category>
		<category><![CDATA[kubectl cordon command]]></category>
		<category><![CDATA[kubectl drain ignore-daemonsets]]></category>
		<category><![CDATA[kubectl drain node force]]></category>
		<category><![CDATA[kubernetes "schedulingdisabled"]]></category>
		<category><![CDATA[kubernetes eviction api]]></category>
		<category><![CDATA[kubernetes remove node]]></category>
		<category><![CDATA[there are pending nodes to be drained]]></category>
		<guid isPermaLink="false">https://linuxroutes.com/?p=3867</guid>

					<description><![CDATA[<p>In this article we will discuss about, how to drain node in Kubernetes cluster.</p>
<p>The post <a href="https://linuxroutes.com/how-to-drain-node-in-kubernetes-cluster-for-maintenance-activity/">How to drain node in Kubernetes cluster for maintenance activity.</a> appeared first on <a href="https://linuxroutes.com">UX Techno</a>.</p>
]]></description>
										<content:encoded><![CDATA[<hr />
<p>In this article we will discuss about, how to drain node in Kubernetes cluster. For maintenance activity such as patching etc.  requires downtime. In order to carry out such activities without impacting applications running within cluster, we need to follow some step by step command. We will discuss those commands in this article for impact less maintenance.<a href="https://linuxroutes.com/wp-content/uploads/2020/12/How-to-drain-node-in-Kubernetes.png"><img loading="lazy" decoding="async" class="size-thumbnail wp-image-3874 alignright" src="https://linuxroutes.com/wp-content/uploads/2020/12/How-to-drain-node-in-Kubernetes-80x80.png" alt="How to drain node in Kubernetes" width="80" height="80" srcset="https://linuxroutes.com/wp-content/uploads/2020/12/How-to-drain-node-in-Kubernetes-80x80.png 80w, https://linuxroutes.com/wp-content/uploads/2020/12/How-to-drain-node-in-Kubernetes-100x100.png 100w" sizes="auto, (max-width: 80px) 100vw, 80px" /></a></p>
<hr />
<h1><span style="color: #ff6600;">How to drain node in Kubernetes cluster?</span></h1>
<p>Pre-requisite:</p>
<p>We have got Kubernetes cluster with one master node and two worker node as below:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">$ kubectl get node
NAME          STATUS   ROLES    AGE    VERSION
k8s-control   Ready    master   167m   v1.18.5
k8s-worker1   Ready    &lt;none&gt;   166m   v1.18.5
k8s-worker2   Ready    &lt;none&gt;   166m   v1.18.5
$ 
</pre>
<p>Now lets run one pod and one deployment with following YAML definition as below for the testing purpose:</p>
<p>Pod Definition:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">$ cat pod.yaml
apiVersion: v1
kind: Pod
metadata:
 name: my-pod
spec:
 containers:
 - name: nginx
   image: nginx
   ports:
   - containerPort: 80
</pre>
<p>Deployment definition:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">$ cat deploy.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-deployment
  labels:
    app: my-deployment
spec:
 replicas: 2
 selector:
    matchLabels:
     app: my-deployment
 template:
   metadata:
    labels:
      app: my-deployment
   spec:
     containers:
     - name: nginx
       image: nginx:1.14.2
       ports:
       - containerPort: 80</pre>
<p>Now lets run both the definition file for creating the objects:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">$ kubectl create -f pod.yaml
pod/my-pod created
$ kubectl create -f deploy.yaml
deployment.apps/my-deployment created
$</pre>
<p>Cross verify the nodes on which Pod and the deployment Pods are running using below command:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">$ kubectl get pods -o wide
NAME                             READY   STATUS    RESTARTS   AGE     IP               NODE          NOMINATED NODE   READINESS GATES
my-deployment-655f58b4cb-2sn4r   1/1     Running   0          25s     192.168.194.70   k8s-worker1   &lt;none&gt;           &lt;none&gt;
my-deployment-655f58b4cb-t4s7t   1/1     Running   0          25s     192.168.126.6    k8s-worker2   &lt;none&gt;           &lt;none&gt;
my-pod                           1/1     Running   0          5m13s   192.168.126.5    k8s-worker2   &lt;none&gt;           &lt;none&gt;
$</pre>
<p>You can also see from the above output that, single Pod is running on the worker node &#8220;k8s-worker2&#8221; and the deployment pods are running on the both the nodes of Kubernetes cluster.</p>
<h3><span style="color: #ff0000;">Draining the node?</span></h3>
<p>Now lets drain the node &#8220;k8s-worker2&#8221; since its running Pod and the deployment Pods also.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">$ kubectl drain k8s-worker2 --ignore-daemonsets --force
node/k8s-worker2 cordoned
WARNING: ignoring DaemonSet-managed Pods: kube-system/calico-node-svhvv, kube-system/kube-proxy-5nk2w; deleting Pods not managed by ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet: default/my-pod
evicting pod default/my-deployment-655f58b4cb-hkdfh
evicting pod default/my-pod
pod/my-pod evicted
pod/my-deployment-655f58b4cb-hkdfh evicted
node/k8s-worker2 evicted
$</pre>
<h3><span style="color: #ff0000;">Note:</span></h3>
<p>Make sure you use the option &#8220;&#8211;ignore-daemonsets&#8221; and &#8220;&#8211;force&#8221; in case you have standalone Pod and deployment running within your Kubernetes cluster other wise system wont allow you to drain the node and it throws following error:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">$ kubectl drain k8s-worker2
node/k8s-worker2 cordoned
error: unable to drain node "k8s-worker2", aborting command...

There are pending nodes to be drained:
 k8s-worker2
cannot delete DaemonSet-managed Pods (use --ignore-daemonsets to ignore): kube-system/calico-node-svhvv, kube-system/kube-proxy-5nk2w
cannot delete Pods not managed by ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet (use --force to override): default/my-pod
$</pre>
<p>Once you drain the node successfully check the status of the node using below command:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">$ kubectl get node
NAME          STATUS                     ROLES    AGE    VERSION
k8s-control   Ready                      master   172m   v1.18.5
k8s-worker1   Ready                      &lt;none&gt;   171m   v1.18.5
k8s-worker2   Ready,SchedulingDisabled   &lt;none&gt;   171m   v1.18.5
$</pre>
<p>In the above output you can see that the node &#8220;k8s-worker2&#8221; has been marked as disabled for Scheduling the resource on it.  Now lets check the status of our Pod and Deployment Pods after draining the node.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">$ kubectl get pods -o wide
NAME                             READY   STATUS    RESTARTS   AGE    IP               NODE          NOMINATED NODE   READINESS GATES
my-deployment-655f58b4cb-2sn4r   1/1     Running   0          116s   192.168.194.70   k8s-worker1   &lt;none&gt;           &lt;none&gt;
my-deployment-655f58b4cb-gtjt4   1/1     Running   0          20s    192.168.194.71   k8s-worker1   &lt;none&gt;           &lt;none&gt;
$</pre>
<p>From the above output its cleared that, the standalone Pod &#8220;my-pod&#8221; being deleted due to Drain activity, however Pod that is being run using deployment got killed and rescheduled on the other node which is &#8220;k8s-worker1&#8221;.</p>
<h3><span style="color: #ff9900;">Joining the maintenance node back again to the Kubernetes cluster: </span></h3>
<p>Now lets assume that, our maintenance activity on the node &#8220;k8s-worker2&#8221; is completed and we want to join the node to our Kubernetes cluster. Then we need to uncordon the node as below:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">$ kubectl uncordon k8s-worker2
node/k8s-worker2 uncordoned
$</pre>
<p>Now if you check the status of the node it will show Ready status and that to without &#8220;SchedulingDisabled&#8221; status as below:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">$ kubectl get node
NAME          STATUS   ROLES    AGE    VERSION
k8s-control   Ready    master   174m   v1.18.5
k8s-worker1   Ready    &lt;none&gt;   174m   v1.18.5
k8s-worker2   Ready    &lt;none&gt;   174m   v1.18.5
$</pre>
<p>And also if you check the status of the deployment Pods its remains unchanged.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">$ kubectl get pods -o wide
NAME                             READY   STATUS    RESTARTS   AGE     IP               NODE          NOMINATED NODE   READINESS GATES
my-deployment-655f58b4cb-2sn4r   1/1     Running   0          3m37s   192.168.194.70   k8s-worker1   &lt;none&gt;           &lt;none&gt;
my-deployment-655f58b4cb-gtjt4   1/1     Running   0          2m1s    192.168.194.71   k8s-worker1   &lt;none&gt;           &lt;none&gt;
$</pre>
<p>This states that, even if you join the maintenance node again back to Kubernetes cluster the earlier running Pods keeps running on the same node.</p>
<p>So this is all about question &#8220;How to drain node in Kubernetes?&#8221; for the maintenance activity.</p>
<p>In case you want to go through other Kubernetes articles follow this <a href="https://linuxroutes.com/category/devops/kubernetes/" target="_blank" rel="noopener noreferrer">link</a>.</p>
<p>The post <a href="https://linuxroutes.com/how-to-drain-node-in-kubernetes-cluster-for-maintenance-activity/">How to drain node in Kubernetes cluster for maintenance activity.</a> appeared first on <a href="https://linuxroutes.com">UX Techno</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://linuxroutes.com/how-to-drain-node-in-kubernetes-cluster-for-maintenance-activity/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Everything you need to know about Kubernetes namespaces.</title>
		<link>https://linuxroutes.com/everything-you-need-to-know-about-kubernetes-namespaces/</link>
					<comments>https://linuxroutes.com/everything-you-need-to-know-about-kubernetes-namespaces/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 04 Dec 2020 12:56:41 +0000</pubDate>
				<category><![CDATA[devops]]></category>
		<category><![CDATA[Kubernetes]]></category>
		<category><![CDATA[kubectl apply namespace]]></category>
		<category><![CDATA[kubectl check if namespace exists]]></category>
		<category><![CDATA[kubectl namespace environment variable]]></category>
		<category><![CDATA[kubernetes delete namespace and all resources]]></category>
		<category><![CDATA[kubernetes deployment namespace]]></category>
		<category><![CDATA[kubernetes namespace best practices]]></category>
		<category><![CDATA[kubernetes namespace yaml]]></category>
		<category><![CDATA[kubernetes specify namespace in yaml]]></category>
		<guid isPermaLink="false">https://linuxroutes.com/?p=3841</guid>

					<description><![CDATA[<p>In this article we will be discussing more about Kubernetes namespaces. Basically we will try to understand what is Kubernetes namespace, how to create it and use it in real scenario.</p>
<p>The post <a href="https://linuxroutes.com/everything-you-need-to-know-about-kubernetes-namespaces/">Everything you need to know about Kubernetes namespaces.</a> appeared first on <a href="https://linuxroutes.com">UX Techno</a>.</p>
]]></description>
										<content:encoded><![CDATA[<hr />
<p>In this article we will be discussing more about Kubernetes namespaces. Basically we will try to understand what is Kubernetes namespace, how to create it and use it in real scenario.<a href="https://linuxroutes.com/wp-content/uploads/2020/12/Kubernetes-namespaces.png"><img loading="lazy" decoding="async" class="alignright wp-image-3864 size-thumbnail" src="https://linuxroutes.com/wp-content/uploads/2020/12/Kubernetes-namespaces-80x80.png" alt="Kubernetes namespaces" width="80" height="80" srcset="https://linuxroutes.com/wp-content/uploads/2020/12/Kubernetes-namespaces-80x80.png 80w, https://linuxroutes.com/wp-content/uploads/2020/12/Kubernetes-namespaces-100x100.png 100w" sizes="auto, (max-width: 80px) 100vw, 80px" /></a></p>
<hr />
<h1><span style="color: #ff6600;">What is Kubernetes namespaces?</span></h1>
<p>Kubernetes namespaces is a virtual cluster being created within the actual Kubernetes cluster. This will bring separation between the different Kubernetes objects such as Pods, deployments and service etc. This will comes handy in order to separate your cluster environment wise or among the different teams.</p>
<h2><span style="color: #ff9900;">How to create Kubernetes namespaces:</span></h2>
<p>Basically there are two methods by which you can create namespaces in Kubernetes:</p>
<ul>
<li>
<h4>By using the YAML based definitions:</h4>
</li>
</ul>
<p>In this method we will defining the namespaces in the YAML file and creating the namespace using the &#8220;kubectl create&#8221; command as below:</p>
<p>Create the sample YAML file with following contents:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="atomic">$ cat ns.yaml
apiVersion: v1
kind: Namespace
metadata:
name: test</pre>
<p>Now create the namespace object using below command:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">$ kubectl create -f ns.yaml
namespace/test created
$</pre>
<p>Now list down all the namespaces to cross-verify whether &#8220;test&#8221; namespace created or not:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">$ kubectl get ns
NAME              STATUS   AGE
default           Active   23m
kube-node-lease   Active   23m
kube-public       Active   23m
kube-system       Active   23m
mobile-gateway    Active   23m
oasis             Active   23m
test              Active   19s
$</pre>
<ul>
<li>Other method will be creating namespace using command line.</li>
</ul>
<p>Here in this method we will be creating the namespace directly using kubectl create command as below:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">$ kubectl create namespace my-namespace
namespace/my-namespace created
$ kubectl get ns
NAME              STATUS   AGE
default           Active   38m
kube-node-lease   Active   38m
kube-public       Active   38m
kube-system       Active   38m
mobile-gateway    Active   38m
my-namespace      Active   57s
oasis             Active   38m
test              Active   15m
$</pre>
<h2><span style="color: #ff9900;">How to create the objects within the namespaces</span></h2>
<p>In this demo we will create sample Pod within the &#8220;test&#8221; namespace that we have created in earlier step. For this create a Pod definition file as below which will define the namespace within which it has to be created.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">$ cat pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: podintest-ns
namespace: test
spec:
containers:
- name: mynginx
image: nginx
$</pre>
<p>Now create the Pod using kubectl create command as below:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">$ kubectl create -f pod.yaml
pod/podintest-ns created
$</pre>
<p>Now in order to list down the Pod status you need to specify the namespace by adding option with &#8220;&#8211;namespace=test&#8221;.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">$ kubectl get pods --namespace=test
NAME           READY   STATUS    RESTARTS   AGE
podintest-ns   1/1     Running   0          11s
$</pre>
<p>Note: In case you dont specify the namespace option while listing out the objects, Kubernetes will show the objects from the default namespace. So you need to make sure that you are specifying the namespaces while listing out the Kubernetes objects.</p>
<h4><span style="color: #ff0000;">Trick!</span></h4>
<p>In case you are not sure about the namespace within which object is created simply use following command which will list down objects(Pods) within all the namespace from the cluster.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">kubectl get pods --all-namespaces</pre>
<h2><span style="color: #ff9900;">Delete namespace</span></h2>
<p>Please note that here while deleting the namespace it will also delete the objects within the namespace. So be cautious while deleting the namespace. In order to delete the namespace use below command:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">$ kubectl delete ns test
namespace "test" deleted
$ kubectl delete ns my-namespace
namespace "my-namespace" deleted
$</pre>
<p>So this is how we can use namespace in Kubernetes cluster in order to separating the objects within your Kubernetes cluster.</p>
<p>The post <a href="https://linuxroutes.com/everything-you-need-to-know-about-kubernetes-namespaces/">Everything you need to know about Kubernetes namespaces.</a> appeared first on <a href="https://linuxroutes.com">UX Techno</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://linuxroutes.com/everything-you-need-to-know-about-kubernetes-namespaces/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to create HostPath persistent volume in Kubernetes</title>
		<link>https://linuxroutes.com/how-to-create-hostpath-persistent-volume-kubernetes/</link>
					<comments>https://linuxroutes.com/how-to-create-hostpath-persistent-volume-kubernetes/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 06 Jul 2020 14:14:57 +0000</pubDate>
				<category><![CDATA[devops]]></category>
		<category><![CDATA[Kubernetes]]></category>
		<guid isPermaLink="false">https://linuxroutes.com/?p=3828</guid>

					<description><![CDATA[<p>This article will guide you about how to create HostPath persistent volume in Kubernetes.</p>
<p>The post <a href="https://linuxroutes.com/how-to-create-hostpath-persistent-volume-kubernetes/">How to create HostPath persistent volume in Kubernetes</a> appeared first on <a href="https://linuxroutes.com">UX Techno</a>.</p>
]]></description>
										<content:encoded><![CDATA[<hr />
<p>This article will guide you about how to create HostPath persistent volume in Kubernetes.<a href="https://linuxroutes.com/wp-content/uploads/2020/07/How-to-create-HostPath-persistent-volume-in-Kubernetes.jpg"><img loading="lazy" decoding="async" class="size-thumbnail wp-image-3831 alignright" src="https://linuxroutes.com/wp-content/uploads/2020/07/How-to-create-HostPath-persistent-volume-in-Kubernetes-80x80.jpg" alt="How to create HostPath persistent volume" width="80" height="80" srcset="https://linuxroutes.com/wp-content/uploads/2020/07/How-to-create-HostPath-persistent-volume-in-Kubernetes-80x80.jpg 80w, https://linuxroutes.com/wp-content/uploads/2020/07/How-to-create-HostPath-persistent-volume-in-Kubernetes-100x100.jpg 100w" sizes="auto, (max-width: 80px) 100vw, 80px" /></a></p>
<hr />
<p>You might be knowing that data in the Pod exists till the life time of the Pod. If the Pod dies all your data that belongs to the Pod is also goes away along with Pod. So if you want to persist your data beyond the life cycle of the Pod then you must have some thing called as a Persistent volume in Kubernetes.</p>
<p>So lets study how to How to create HostPath persistent volume which is very easy to experiment. Also to gain knowledge about the fundamentals about the Persistent volume.</p>
<p>There are following types of Persistent volume types available to use within kubernetes by different vendors.</p>
<ul>
<li>GCEPersistentDisk</li>
<li>AWSElasticBlockStore</li>
<li>AzureFile</li>
<li>AzureDisk</li>
<li>CSI</li>
<li>FC (Fibre Channel)</li>
<li>FlexVolume</li>
<li>Flocker</li>
<li>NFS</li>
<li>iSCSI</li>
<li>RBD (Ceph Block Device)</li>
<li>CephFS</li>
<li>Cinder (OpenStack block storage)</li>
<li>Glusterfs</li>
<li>VsphereVolume</li>
<li>Quobyte Volumes</li>
<li>HostPath (Single node testing only &#8212; local storage is not supported in any way and WILL NOT WORK in a multi-node cluster)</li>
<li>Portworx Volumes</li>
<li>ScaleIO Volumes</li>
<li>StorageOS</li>
</ul>
<p>As you can see for the HostPath it should be used only for the <strong>testing purpose. </strong>Also it does not support multi-node cluster. In case you want to explore more about the Persistent volumes you may follow this <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/" target="_blank" rel="noopener noreferrer">link</a>.</p>
<p>The Basic process for Persistent volumes is as follows:</p>
<ol>
<li>K8s admin create the persistence volume in cluster.</li>
<li>User will claim it using Persistent volume claim once they claimed it status becomes &#8220;Bound&#8221;.</li>
<li>Then Pod use that volume for storing out the data which will persist across the life-cycle of Pod.</li>
</ol>
<p>Enough for the theory Part Lets jump the Technical steps towards it:</p>
<ul>
<li>Create the persistent volume</li>
</ul>
<p>In this step we are using following manifest yaml file to achieve the same.</p>
<pre class="lang:default decode:true"># cat hostpath-pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv-hostpath
  labels:
    type: local
spec:
  storageClassName: manual
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/tmp/kube"
</pre>
<p>As shown in the above definition file it is for the size 1GB. Path is &#8220;/tmp/kube&#8221;. Lets create the PV as below:</p>
<pre class="lang:default decode:true"># kubectl create -f hostpath-pv.yaml
persistentvolume/pv-hostpath created
</pre>
<p>Recheck the PV and persistent volume claim using below command:</p>
<pre class="lang:default decode:true "># kubectl get pv,pvc -o wide
NAME                           CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS      CLAIM   STORAGECLASS   REASON   AGE   VOLUMEMODE
persistentvolume/pv-hostpath   1Gi        RWO            Retain           Available           manual                  6s    Filesystem
</pre>
<p>As you can see the PV is created having status as Available and since we haven&#8217;t specified the reclaim policy default is applied which is &#8220;Retain&#8221; meaning that the even if the pvc (Persistent volume claim) gets deleted the PV and data wont get deleted automatically. We will test it out that also in a bit.</p>
<ul>
<li>Create the Persistent volume claim</li>
</ul>
<p>In order to use the PV we need to create the Persistent volume claim or pvc to use it.  Here is the manifest yaml file for the same.</p>
<pre class="lang:default decode:true"># cat pvc-hostpath.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-hostpath
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Mi
</pre>
<p>Kindly note in the above definition that the claim is only for the 100mb(&gt;= size of PV) also the Access mode is &#8220;ReadWriteOnce&#8221; which is same as that of PV. Hence we can able to create the PVC as below:</p>
<pre class="lang:default decode:true "># kubectl create -f pvc-hostpath.yaml
persistentvolumeclaim/pvc-hostpath created
</pre>
<p>Check the status of pv and pvc.</p>
<pre class="lang:default decode:true "># kubectl get pv,pvc -o wide
NAME                           CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                  STORAGECLASS   REASON   AGE   VOLUMEMODE
persistentvolume/pv-hostpath   1Gi        RWO            Retain           Bound    default/pvc-hostpath   manual                  20s   Filesystem

NAME                                 STATUS   VOLUME        CAPACITY   ACCESS MODES   STORAGECLASS   AGE   VOLUMEMODE
persistentvolumeclaim/pvc-hostpath   Bound    pv-hostpath   1Gi        RWO            manual         4s    Filesystem
</pre>
<p>You will see that the status of the pv becomes Bound from Available which was earlier.</p>
<ul>
<li>Create the Pod to utilize this PV as a mount point inside it.</li>
</ul>
<pre class="lang:default decode:true"># cat busybox-pv-hostpath.yaml
apiVersion: v1
kind: Pod
metadata:
  name: busybox
spec:
  volumes:
  - name: host-volume
    persistentVolumeClaim:
      claimName: pvc-hostpath
  containers:
  - image: busybox
    name: busybox
    command: ["/bin/sh"]
    args: ["-c", "sleep 600"]
    volumeMounts:
    - name: host-volume
      mountPath: /tmp/mydata
</pre>
<p>As describe in the Pod definition file it will create the mount point /tmp/mydata inside the Pod. Lets create the Pod using above definition file.</p>
<pre class="lang:default decode:true "># kubectl create -f busybox-pv-hostpath.yaml
pod/busybox created
</pre>
<p>Check the status and inspect the Pod:</p>
<pre class="lang:default decode:true"># kubectl get all -o wide
NAME          READY   STATUS    RESTARTS   AGE    IP             NODE        NOMINATED NODE   READINESS GATES
pod/busybox   1/1     Running   0          2m4s   10.244.1.114   kworker01   &lt;none&gt;           &lt;none&gt;

NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE   SELECTOR
service/kubernetes   ClusterIP   10.96.0.1    &lt;none&gt;        443/TCP   35d   &lt;none&gt;

# kubectl describe pod busybox
Name:         busybox
Namespace:    default
Priority:     0
Node:         kworker01/10.253.121.32
Start Time:   Mon, 06 Jul 2020 02:43:16 -0400
Labels:       &lt;none&gt;
Annotations:  &lt;none&gt;
Status:       Running
IP:           10.244.1.114
IPs:
  IP:  10.244.1.114
Containers:
  busybox:
    Container ID:  docker://6d1cfa9b6440efe2770244d1edc6a78c0dd7649bbf905121e70a013ad3b1dd1e
    Image:         busybox
    Image ID:      docker-pullable://busybox@sha256:9ddee63a712cea977267342e8750ecbc60d3aab25f04ceacfa795e6fce341793
    Port:          &lt;none&gt;
    Host Port:     &lt;none&gt;
    Command:
      /bin/sh
    Args:
      -c
      sleep 600
    State:          Running
      Started:      Mon, 06 Jul 2020 02:43:25 -0400
    Ready:          True
    Restart Count:  0
    Environment:    &lt;none&gt;
    Mounts:
      /tmp/mydata from host-volume (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-49xz2 (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             True
  ContainersReady   True
  PodScheduled      True
Volumes:
  host-volume:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  pvc-hostpath
    ReadOnly:   false
  default-token-49xz2:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-49xz2
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  &lt;none&gt;
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type    Reason     Age        From                Message
  ----    ------     ----       ----                -------
  Normal  Scheduled  &lt;unknown&gt;  default-scheduler   Successfully assigned default/busybox to kworker01
  Normal  Pulling    64s        kubelet, kworker01  Pulling image "busybox"
  Normal  Pulled     58s        kubelet, kworker01  Successfully pulled image "busybox"
  Normal  Created    58s        kubelet, kworker01  Created container busybox
  Normal  Started    57s        kubelet, kworker01  Started container busybox
</pre>
<p>In the describe output you can see that, /tmp/mydata volume got created using host-volume from the claim pvc-hostpath. Also the Pod is scheduled/create on the node &#8220;kworker01&#8221;.</p>
<p>Lets login inside the Pod to create the sample file. In order to demonstrate the life cycle of the data even if the Pod dies.</p>
<pre class="lang:default decode:true "># kubectl exec -it busybox -- sh
/ # hostname
busybox
/ # cd /tmp/
/tmp # ls
mydata
/tmp # cd mydata/
/tmp/mydata # echo "hello from K8S" &gt; Hello.txt
/tmp/mydata # ls -ltr
total 4
-rw-r--r--    1 root     root            15 Jul  6 06:46 Hello.txt
/tmp/mydata #
</pre>
<p>In the above demo we have created file &#8220;Hello.txt&#8221; inside /tmp/mydata. Now lets delete the Pod.</p>
<pre class="lang:default decode:true "># kubectl delete pod busybox
pod "busybox" deleted
root@vbhost:~/kubernetes/yamls# kubectl get all
NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.96.0.1    &lt;none&gt;        443/TCP   35d
</pre>
<p>Pod got deleted successfully lets login to the node &#8220;kworker01&#8221; where Pod got scheduled earlier to check if the data still persist after the deletion of the Pod.</p>
<pre class="lang:default decode:true ">sh-4.2# hostname
kworker01
sh-4.2# cd /tmp
sh-4.2# ls
kube
sh-4.2# cd kube/
sh-4.2# ls
Hello.txt
sh-4.2# cat Hello.txt
hello from K8S
sh-4.2# exit
</pre>
<p>You can see that our file &#8220;Hello.txt&#8221; still exists on the Node even the Pod dies.</p>
<p>So this is all about &#8220;How to create HostPath persistent volume&#8221; in Kubernetes.</p>
<p>&nbsp;</p>
<p>The post <a href="https://linuxroutes.com/how-to-create-hostpath-persistent-volume-kubernetes/">How to create HostPath persistent volume in Kubernetes</a> appeared first on <a href="https://linuxroutes.com">UX Techno</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://linuxroutes.com/how-to-create-hostpath-persistent-volume-kubernetes/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to configure ingress controller in kubernetes to run multi domain-subdomain application</title>
		<link>https://linuxroutes.com/how-to-configure-ingress-controller-in-kubernetes-to-run-multi-domain-subdomain-application/</link>
					<comments>https://linuxroutes.com/how-to-configure-ingress-controller-in-kubernetes-to-run-multi-domain-subdomain-application/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 02 Jul 2020 15:09:32 +0000</pubDate>
				<category><![CDATA[devops]]></category>
		<category><![CDATA[Kubernetes]]></category>
		<category><![CDATA[how to configure ingress controller]]></category>
		<category><![CDATA[ingress controller confguration]]></category>
		<guid isPermaLink="false">https://linuxroutes.com/?p=3808</guid>

					<description><![CDATA[<p>In this article we are going to learn how to configure ingress controller in kubernetes so that we could run multi domain or subdomain application within same kubernetes cluster. </p>
<p>The post <a href="https://linuxroutes.com/how-to-configure-ingress-controller-in-kubernetes-to-run-multi-domain-subdomain-application/">How to configure ingress controller in kubernetes to run multi domain-subdomain application</a> appeared first on <a href="https://linuxroutes.com">UX Techno</a>.</p>
]]></description>
										<content:encoded><![CDATA[<hr />
<p>In this article we are going to learn  how to configure ingress controller in kubernetes so that we could run multi domain or subdomain application within same kubernetes cluster.</p>
<p><a href="https://linuxroutes.com/wp-content/uploads/2020/07/How-to-configure-ingress-controller-in-kubernetes.jpg"><img loading="lazy" decoding="async" class="size-thumbnail wp-image-3820 alignright" src="https://linuxroutes.com/wp-content/uploads/2020/07/How-to-configure-ingress-controller-in-kubernetes-80x80.jpg" alt="How to configure ingress controller in kubernetes" width="80" height="80" srcset="https://linuxroutes.com/wp-content/uploads/2020/07/How-to-configure-ingress-controller-in-kubernetes-80x80.jpg 80w, https://linuxroutes.com/wp-content/uploads/2020/07/How-to-configure-ingress-controller-in-kubernetes-100x100.jpg 100w" sizes="auto, (max-width: 80px) 100vw, 80px" /></a></p>
<hr />
<p>In this demo we are going to run application with domain &#8220;nginx.example.com&#8221; and other two subdomain called</p>
<p>tea.myshop.com and coffee.myshop.com in kubernetes using Nginx ingress controller. Please note that, these domains and subdomains are local domains.</p>
<p>To show case this demo about &#8220;How to configure ingress controller in kubernetes&#8221; I am using lxc containers install on Ubuntu(Bare-metal installation). Basically I have four containers/vms running on the lxc host as below:</p>
<pre class="lang:default decode:true ">root@vbhost:~# lxc list
+-----------+---------+------------------------+-----------------------------------------------+------------+-----------+
|   NAME    |  STATE  |          IPV4          |                     IPV6                      |    TYPE    | SNAPSHOTS |
+-----------+---------+------------------------+-----------------------------------------------+------------+-----------+
| haproxy   | RUNNING | 10.253.121.146 (eth0)  | fd42:38af:bc0d:704d:216:3eff:fefa:cb4c (eth0) | PERSISTENT | 0         |
+-----------+---------+------------------------+-----------------------------------------------+------------+-----------+
| kmaster   | RUNNING | 172.17.0.1 (docker0)   | fd42:38af:bc0d:704d:216:3eff:fe31:7a49 (eth0) | PERSISTENT | 0         |
|           |         | 10.253.121.39 (eth0)   |                                               |            |           |
|           |         | 10.244.0.0 (flannel.1) |                                               |            |           |
+-----------+---------+------------------------+-----------------------------------------------+------------+-----------+
| kworker01 | RUNNING | 172.17.0.1 (docker0)   | fd42:38af:bc0d:704d:216:3eff:fed4:8226 (eth0) | PERSISTENT | 0         |
|           |         | 10.253.121.32 (eth0)   |                                               |            |           |
|           |         | 10.244.1.1 (cni0)      |                                               |            |           |
|           |         | 10.244.1.0 (flannel.1) |                                               |            |           |
+-----------+---------+------------------------+-----------------------------------------------+------------+-----------+
| kworker02 | RUNNING | 172.17.0.1 (docker0)   | fd42:38af:bc0d:704d:216:3eff:fe9f:82c0 (eth0) | PERSISTENT | 0         |
|           |         | 10.253.121.89 (eth0)   |                                               |            |           |
|           |         | 10.244.2.1 (cni0)      |                                               |            |           |
|           |         | 10.244.2.0 (flannel.1) |                                               |            |           |
+-----------+---------+------------------------+-----------------------------------------------+------------+-----------+
</pre>
<ul>
<li>So all these containers are running centos. Three of them are being used for kubernetes cluster. One will be using for haproxy which we will be utilizing as a loadbalancer to load balance the request to one of the two kubernetes worker node.</li>
</ul>
<p>To learn more about lxc containers follow this <a href="https://www.linuxtechi.com/install-lxd-lxc-containers-from-scratch/" target="_blank" rel="noopener noreferrer">link</a>.</p>
<p>Steps:</p>
<ul>
<li>
<h2><span style="color: #ff0000;">Deploy kubernetes cluster:</span></h2>
</li>
</ul>
<p>Once you deployed three lxc containers configure one of them as kubernetes master and other two as kubernetes worker node. To cut short the configuration journey  you can follow this <a href="https://www.sayem.org/k8s-on-lxd/" target="_blank" rel="noopener noreferrer">link</a>.</p>
<ul>
<li>
<h2><span style="color: #ff0000;">Deploy ha-proxy container with centos operating system:</span></h2>
</li>
</ul>
<p>We will be deploying one more lxc container with centos and will be configuring haproxy as per below steps:</p>
<ul>
<li>login to lxc container</li>
</ul>
<pre class="lang:default decode:true ">root@vbhost:~# lxc exec haproxy bash
[root@haproxy ~]#</pre>
<p>Now install the haproxy package in the container</p>
<pre class="lang:default decode:true"># yum install haproxy</pre>
<p>Once you have installed haproxy we need change the configuration so that it will load balance the traffic between the kubernetes worker node. Open the /etc/haproxy/haproxy.cfg file and replace it with below contents:</p>
<pre class="lang:default decode:true ">[root@haproxy ~]# cat /etc/haproxy/haproxy.cfg
#---------------------------------------------------------------------
# Example configuration for a possible web application.  See the
# full configuration options online.
#
#   http://haproxy.1wt.eu/download/1.4/doc/configuration.txt
#
#---------------------------------------------------------------------

#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
    # to have these messages end up in /var/log/haproxy.log you will
    # need to:
    #
    # 1) configure syslog to accept network log events.  This is done
    #    by adding the '-r' option to the SYSLOGD_OPTIONS in
    #    /etc/sysconfig/syslog
    #
    # 2) configure local2 events to go to the /var/log/haproxy.log
    #   file. A line like the following can be added to
    #   /etc/sysconfig/syslog
    #
    #    local2.*                       /var/log/haproxy.log
    #
    log         127.0.0.1 local2

    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon

    # turn on stats unix socket
    stats socket /var/lib/haproxy/stats

#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 3000

frontend http_front
  bind *:80
  stats uri /haproxy?stats
  default_backend http_back

backend http_back
  balance roundrobin
  server kube 10.253.121.32:80
  server kube 10.253.121.89:80
[root@haproxy ~]#
</pre>
<p>Make sure you change the bottom two ip address with ip address of the kubernetes worker nodes so that it could be load balanced. Here are the ip adress of my worker node which we have entered in the above haproxy configuration file. Also we are using http port 80 for our configuration.</p>
<pre class="lang:default decode:true "># kubectl get nodes -o wide
NAME        STATUS   ROLES    AGE   VERSION   INTERNAL-IP     EXTERNAL-IP   OS-IMAGE                KERNEL-VERSION       CONTAINER-RUNTIME
kmaster     Ready    master   31d   v1.17.1   10.253.121.39   &lt;none&gt;        CentOS Linux 7 (Core)   4.15.0-106-generic   docker://19.3.5
kworker01   Ready    &lt;none&gt;   31d   v1.17.1   10.253.121.32   &lt;none&gt;        CentOS Linux 7 (Core)   4.15.0-106-generic   docker://19.3.5
kworker02   Ready    &lt;none&gt;   31d   v1.17.1   10.253.121.89   &lt;none&gt;        CentOS Linux 7 (Core)   4.15.0-106-generic   docker://19.3.5
#
</pre>
<p>Now restart and enable the haproxy service.</p>
<pre class="lang:default decode:true "># systemctl enable haproxy
# systemctl restart haproxy</pre>
<p>We are done with haproxy configuration. Now logout from it.</p>
<ul>
<li>
<h2><span style="color: #ff0000;">Install the Nginx-controller on kubernetes master node:</span></h2>
</li>
</ul>
<p>Clone the git repo  and change directory to &#8220;kubernetes-ingress/deployments/&#8221;</p>
<pre class="lang:default decode:true "># git clone https://github.com/nginxinc/kubernetes-ingress.git
# cd kubernetes-ingress/deployments/
</pre>
<p>Create the namespace and service account.</p>
<pre class="lang:default decode:true "># kubectl apply -f common/ns-and-sa.yaml</pre>
<p>Apply the role and cluster role binding</p>
<pre class="lang:default decode:true "># kubectl apply -f rbac/rbac.yaml</pre>
<p>Make the secret</p>
<pre class="lang:default decode:true "># kubectl apply -f common/default-server-secret.yaml</pre>
<p>apply the configmap required.</p>
<pre class="lang:default decode:true "># kubectl apply -f common/nginx-config.yaml</pre>
<p>Now deploy the Ingress controller as daemon-set</p>
<pre class="lang:default decode:true "># kubectl apply -f daemon-set/nginx-ingress.yaml</pre>
<p>Now if you check the namespace and the resources within &#8220;nginx-ingress&#8221; namespace you will find similar resources being created.</p>
<pre class="lang:default decode:true "># kubectl get ns
NAME              STATUS   AGE
cattle-system     Active   29d
default           Active   31d
efk               Active   29d
kube-node-lease   Active   31d
kube-public       Active   31d
kube-system       Active   31d
nginx-ingress     Active   10s
</pre>
<pre class="lang:default decode:true "># kubectl get all -n nginx-ingress
NAME                      READY   STATUS              RESTARTS   AGE
pod/nginx-ingress-2rq6s   0/1     ContainerCreating   0          14s
pod/nginx-ingress-65vnd   0/1     ContainerCreating   0          14s

NAME                           DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE
daemonset.apps/nginx-ingress   2         2         0       2            0           &lt;none&gt;          14s
</pre>
<p>Once they are ready we are going to deploy services.</p>
<ul>
<li>Deploy the Nginx service with NodePort type listening on port 80 which will run sample Nginx web-server with its default index.html file. Here is manifest file I am using for it.</li>
</ul>
<pre class="lang:default decode:true "># cat nginx-deploy-main.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    run: nginx
  name: nginx-deploy-main
spec:
  replicas: 1
  selector:
    matchLabels:
      run: nginx-main
  template:
    metadata:
      labels:
        run: nginx-main
    spec:
      containers:
      - image: nginx
        name: nginx


---
apiVersion: v1
kind: Service
metadata:
  name: nginx-deploy-main
spec:
  type: NodePort
  selector:
    run: nginx-main
  ports:
      # By default and for convenience, the `targetPort` is set to the same value as the `port` field.
    - port: 80
</pre>
<p>Deploy the Nginx service</p>
<pre class="lang:default decode:true "># kubectl create -f nginx-deploy-main.yaml
deployment.apps/nginx-deploy-main created
service/nginx-deploy-main created</pre>
<ul>
<li>
<h2><span style="color: #ff0000;">Deploy the tea service </span></h2>
</li>
</ul>
<p>Now lets deploy the another service which will be of the type NodePort with port 80.  For this service I am using my own created docker image called &#8220;manmohanmirkar/mytea_image&#8221; which will simply display the message &#8220;This is Tea Shop&#8221; in the browser. This service will be get called once you  try to access url &#8220;tea.myshop.com&#8221; . Sample manifest file is as below:</p>
<pre class="lang:default decode:true "># cat tea.yml
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: tea
  name: tea-deploy
spec:
  replicas: 2
  selector:
    matchLabels:
      app: tea
  template:
    metadata:
      labels:
        app: tea
    spec:
      containers:
      - name: tea
        image: manmohanmirkar/mytea_image:latest

---
apiVersion: v1
kind: Service
metadata:
  name: tea-deploy
spec:
  type: NodePort
  selector:
    app: tea
  ports:
      # By default and for convenience, the `targetPort` is set to the same value as the `port` field.
    - port: 80
</pre>
<p>Apply the tea service:</p>
<pre class="lang:default decode:true "># kubectl create -f tea.yml
deployment.apps/tea-deploy created
service/tea-deploy created
</pre>
<ul>
<li>
<h2><span style="color: #ff0000;">Configure the coffee service</span></h2>
</li>
</ul>
<p>Deploy one more service which will be of the type NodePort with port 80.  For this service I am using my own created docker image called &#8220;manmohanmirkar/mycoffee_image&#8221; which will simply display the message &#8220;This is Coffee Shop&#8221; in the browser. This service will be get called once you  try to access url &#8220;coffee.myshop.com&#8221; . Sample manifest file is as below:</p>
<pre class="lang:default decode:true "># cat coffe.yml
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: coffee
  name: coffee-deploy
spec:
  replicas: 2
  selector:
    matchLabels:
      app: coffee
  template:
    metadata:
      labels:
        app: coffee
    spec:
      containers:
      - name: coffee
        image: manmohanmirkar/mycoffee_image:latest
---
apiVersion: v1
kind: Service
metadata:
  name: coffee-deploy
spec:
  type: NodePort
  selector:
    app: coffee
  ports:
      # By default and for convenience, the `targetPort` is set to the same value as the `port` field.
    - port: 80</pre>
<p>Now lets apply the coffee service and deployment.</p>
<pre class="lang:default decode:true "># kubectl create -f coffe.yml
deployment.apps/coffee-deploy created
service/coffee-deploy created
</pre>
<ul>
<li>
<h2><span style="color: #ff0000;">Deploy the Ingress resource</span></h2>
</li>
</ul>
<p>This is the main configuration in this article which will configure the Ingress resource. This Ingress resource will be performing the task of routing the request to respective service based on the URL. Let have look at the manifest file for the same:</p>
<pre class="lang:default decode:true"># cat cafe-ingress.yml
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: my-ingress-resource
spec:
  rules:
  - host: nginx.example.com
    http:
      paths:
      - backend:
          serviceName: nginx-deploy-main
          servicePort: 80
  - host: tea.myshop.com
    http:
      paths:
      - backend:
          serviceName: tea-deploy
          servicePort: 80
  - host: coffee.myshop.com
    http:
      paths:
      - backend:
          serviceName: coffee-deploy
          servicePort: 80
</pre>
<p>Basically in the above file will deploy the resource type Ingress. It has got three host based rules configured for each service. So if the host url is &#8220;nginx.example.com&#8221; then it has backend with service Name &#8220;nginx-deploy-main&#8221;. Basically it means that whenever the request with URL &#8220;nginx.example.com&#8221; made it will be get forwarded to the service &#8220;nginx-deploy-main&#8221;.</p>
<p>In the similar way we have two more hosts &#8220;tea.myshop.com&#8221; and &#8220;coffee.myshop.com&#8221; with backed configured as &#8220;tea-deploy&#8221; and &#8220;coffee-deploy&#8221;. This also means that whenever the request made with URL &#8220;tea.myshop.com&#8221; to the haproxy serrver it will forwarded to the service &#8220;tea-deploy&#8221;. Also in the similar way if the request with URL &#8220;coffee.myshop.com&#8221; it will be automatically get forwarded to the service &#8220;coffee-deploy&#8221; which we have already deployed.</p>
<p>Now lets deploy the ingress resource:</p>
<pre class="lang:default decode:true "># kubectl create -f cafe-ingress.yml
ingress.networking.k8s.io/my-ingress-resource created
</pre>
<p>Crosscheck the ingress resource with following commands:</p>
<pre class="lang:default decode:true"># kubectl describe ing
Name:             my-ingress-resource
Namespace:        default
Address:
Default backend:  default-http-backend:80 (&lt;error: endpoints "default-http-backend" not found&gt;)
Rules:
  Host               Path  Backends
  ----               ----  --------
  nginx.example.com
                        nginx-deploy-main:80 (10.244.2.82:80)
  tea.myshop.com
                        tea-deploy:80 (10.244.1.94:80,10.244.2.83:80)
  coffee.myshop.com
                        coffee-deploy:80 (10.244.1.95:80,10.244.2.84:80)
Annotations:         &lt;none&gt;
Events:
  Type    Reason          Age   From                      Message
  ----    ------          ----  ----                      -------
  Normal  AddedOrUpdated  31s   nginx-ingress-controller  Configuration for default/my-ingress-resource was added or updated
  Normal  AddedOrUpdated  31s   nginx-ingress-controller  Configuration for default/my-ingress-resource was added or updated
</pre>
<p>You can able to see from the output that, if the host is &#8220;nginx.example.com&#8221; then service configured is &#8220;nginx-deploy-main&#8221; and if the host or URL is &#8220;tea.myshop.com&#8221; then service for the same is &#8220;tea-deploy&#8221; sample applicable for the coffee service with respective service name.</p>
<ul>
<li>
<h2><span style="color: #ff0000;">Make the DNS entries</span></h2>
</li>
</ul>
<p>This is the final step in which we are going to configure the DNS entries for all the three URL we have configured in the ingress resource. Basically we are going make the entries on the host machine with all the urls with ip of out haproxy container.</p>
<pre class="lang:default decode:true "># lxc list haproxy
+---------+---------+-----------------------+-----------------------------------------------+------------+-----------+
|  NAME   |  STATE  |         IPV4          |                     IPV6                      |    TYPE    | SNAPSHOTS |
+---------+---------+-----------------------+-----------------------------------------------+------------+-----------+
| haproxy | RUNNING | 10.253.121.146 (eth0) | fd42:38af:bc0d:704d:216:3eff:fefa:cb4c (eth0) | PERSISTENT | 0         |
+---------+---------+-----------------------+-----------------------------------------------+------------+-----------+
</pre>
<p>So ip address of haproxy is 10.253.121.146. Simply add below entries /etc/hosts of the host machine:</p>
<pre class="lang:default decode:true "># cat /etc/hosts
127.0.0.1       localhost
192.168.56.5    vbhost

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters



10.253.121.146 nginx.example.com
10.253.121.146 coffee.myshop.com
10.253.121.146 tea.myshop.com
</pre>
<p>Check the last three entries all url are pointing to haproxy which will in turn forward the request to our kubernetes worker node.</p>
<ul>
<li>
<h2><span style="color: #ff0000;">Testing </span></h2>
</li>
</ul>
<p>Now lets try to access the all URL&#8217;s one by one from the host machine.</p>
<ul>
<li>nginx.example.com</li>
</ul>
<p><a href="https://linuxroutes.com/wp-content/uploads/2020/07/nginx-example.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3813" src="https://linuxroutes.com/wp-content/uploads/2020/07/nginx-example.png" alt="how to configure ingress controller" width="798" height="607" srcset="https://linuxroutes.com/wp-content/uploads/2020/07/nginx-example.png 798w, https://linuxroutes.com/wp-content/uploads/2020/07/nginx-example-300x228.png 300w, https://linuxroutes.com/wp-content/uploads/2020/07/nginx-example-768x584.png 768w" sizes="auto, (max-width: 798px) 100vw, 798px" /></a></p>
<ul>
<li>tea.myshop.com</li>
</ul>
<p><a href="https://linuxroutes.com/wp-content/uploads/2020/07/tea.png"><img loading="lazy" decoding="async" class="alignnone wp-image-3814 size-full" src="https://linuxroutes.com/wp-content/uploads/2020/07/tea.png" alt="How to configure ingress controller" width="801" height="622" srcset="https://linuxroutes.com/wp-content/uploads/2020/07/tea.png 801w, https://linuxroutes.com/wp-content/uploads/2020/07/tea-300x233.png 300w, https://linuxroutes.com/wp-content/uploads/2020/07/tea-768x596.png 768w" sizes="auto, (max-width: 801px) 100vw, 801px" /></a></p>
<ul>
<li>coffee.myshop.com</li>
</ul>
<p><a href="https://linuxroutes.com/wp-content/uploads/2020/07/coffee.png"><img loading="lazy" decoding="async" class="alignnone wp-image-3815 size-full" src="https://linuxroutes.com/wp-content/uploads/2020/07/coffee.png" alt="How to configure ingress controller" width="802" height="621" srcset="https://linuxroutes.com/wp-content/uploads/2020/07/coffee.png 802w, https://linuxroutes.com/wp-content/uploads/2020/07/coffee-300x232.png 300w, https://linuxroutes.com/wp-content/uploads/2020/07/coffee-768x595.png 768w" sizes="auto, (max-width: 802px) 100vw, 802px" /></a></p>
<p>So this all about the topic of How to configure ingress controller in kubernetes.</p>
<p>The post <a href="https://linuxroutes.com/how-to-configure-ingress-controller-in-kubernetes-to-run-multi-domain-subdomain-application/">How to configure ingress controller in kubernetes to run multi domain-subdomain application</a> appeared first on <a href="https://linuxroutes.com">UX Techno</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://linuxroutes.com/how-to-configure-ingress-controller-in-kubernetes-to-run-multi-domain-subdomain-application/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to migrate helm v2 to helm v3</title>
		<link>https://linuxroutes.com/how-to-migrate-helm-v2-to-helm-v3/</link>
					<comments>https://linuxroutes.com/how-to-migrate-helm-v2-to-helm-v3/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 30 Jun 2020 10:19:49 +0000</pubDate>
				<category><![CDATA[devops]]></category>
		<category><![CDATA[Helm]]></category>
		<category><![CDATA[Kubernetes]]></category>
		<category><![CDATA[how to migrate helm v2 to helm v3]]></category>
		<category><![CDATA[migration helm v2 to helm v3]]></category>
		<guid isPermaLink="false">https://linuxroutes.com/?p=3800</guid>

					<description><![CDATA[<p>This article will guide you about how to migrate helm v2 to helm v3 along with currently running resources in the environment. </p>
<p>The post <a href="https://linuxroutes.com/how-to-migrate-helm-v2-to-helm-v3/">How to migrate helm v2 to helm v3</a> appeared first on <a href="https://linuxroutes.com">UX Techno</a>.</p>
]]></description>
										<content:encoded><![CDATA[<hr />
<p>This article will guide you about how to migrate helm v2 to helm v3 along with currently running resources in the environment.<a href="https://linuxroutes.com/wp-content/uploads/2020/06/How-to-migrate-helm-v2-to-helm-v3.jpg"><img loading="lazy" decoding="async" class="size-thumbnail wp-image-3805 alignright" src="https://linuxroutes.com/wp-content/uploads/2020/06/How-to-migrate-helm-v2-to-helm-v3-80x80.jpg" alt="migrate helm v2 to helm v3" width="80" height="80" srcset="https://linuxroutes.com/wp-content/uploads/2020/06/How-to-migrate-helm-v2-to-helm-v3-80x80.jpg 80w, https://linuxroutes.com/wp-content/uploads/2020/06/How-to-migrate-helm-v2-to-helm-v3-100x100.jpg 100w" sizes="auto, (max-width: 80px) 100vw, 80px" /></a></p>
<hr />
<p>In my previous <a href="https://linuxroutes.com/how-to-install-helm-in-kubernetes-cluster/" target="_blank" rel="noopener noreferrer">article</a> we have seen how to install helm version 2. Now in this article we are going to migrate currently running helm v2 configuration and its running resources to helm v3. To perform migration of helm v2 to helm v3 we are going to install plugin called 2to3 in the helm3.</p>
<h2><span style="color: #ff0000;">Steps to migrate helm v2 to helm v3:</span></h2>
<ul>
<li>Check currently running resources in helm v2</li>
</ul>
<pre class="lang:default decode:true"># helm ls
NAME    REVISION        UPDATED                         STATUS          CHART           APP VERSION     NAMESPACE
mynginx 1               Tue Jun 30 02:22:13 2020        DEPLOYED        nginx-6.0.1     1.19.0          default
</pre>
<pre class="lang:default decode:true "># kubectl get all
NAME                           READY   STATUS    RESTARTS   AGE
pod/mynginx-5bd8cb6d45-k5vlx   1/1     Running   0          54s

NAME                 TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
service/kubernetes   ClusterIP   10.96.0.1        &lt;none&gt;        443/TCP                      28d
service/mynginx      NodePort    10.103.194.212   &lt;none&gt;        80:30672/TCP,443:30500/TCP   54s

NAME                      READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/mynginx   1/1     1            1           54s

NAME                                 DESIRED   CURRENT   READY   AGE
replicaset.apps/mynginx-5bd8cb6d45   1         1         1       54s
</pre>
<ul>
<li>Download helm v3 binaries and unzip it.</li>
</ul>
<p>Please note that helm v3 dont have tiller component running within kubernetes cluster.</p>
<pre class="lang:default decode:true "># wget https://get.helm.sh/helm-v3.2.4-linux-amd64.tar.gz
--2020-06-30 02:24:33--  https://get.helm.sh/helm-v3.2.4-linux-amd64.tar.gz
Resolving get.helm.sh (get.helm.sh)... 152.199.39.108, 2606:2800:247:1cb7:261b:1f9c:2074:3c
Connecting to get.helm.sh (get.helm.sh)|152.199.39.108|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12926032 (12M) [application/x-tar]
Saving to: ‘helm-v3.2.4-linux-amd64.tar.gz.1’

helm-v3.2.4-linux-amd64.tar.gz.1  100%[============================================================&gt;]  12.33M  2.73MB/s    in 4.4s

2020-06-30 02:24:39 (2.77 MB/s) - ‘helm-v3.2.4-linux-amd64.tar.gz.1’ saved [12926032/12926032]
</pre>
<pre class="lang:default decode:true"># tar -zxvf helm-v3.2.4-linux-amd64.tar.gz
linux-amd64/
linux-amd64/helm
linux-amd64/README.md
linux-amd64/LICENSE
</pre>
<p>Now once we unzipped the file change directory to &#8220;linux-amd64&#8221;. You will find helm binary. Now we are going to copy this binary as helm3 at the location /usr/local/bin in order to differentiate between helm v2 and helm v3 binary.</p>
<pre class="lang:default decode:true"># cd linux-amd64
# mv helm /usr/local/bin/helm3</pre>
<p>Check the version details of the helm v3 binary.</p>
<pre class="lang:default decode:true "># helm3 version
version.BuildInfo{Version:"v3.2.4", GitCommit:"0ad800ef43d3b826f31a5ad8dfbb4fe05d143688", GitTreeState:"clean", GoVersion:"go1.13.12"
# helm3 version --short
v3.2.4+g0ad800e
</pre>
<p>just cross check whether we have currently manage chart in helm v2 and helm v3 version using helm list command as  below:</p>
<pre class="lang:default decode:true "># helm3 list
NAME    NAMESPACE       REVISION        UPDATED STATUS  CHART   APP VERSION
# helm list
NAME    REVISION        UPDATED                         STATUS          CHART           APP VERSION     NAMESPACE
mynginx 1               Tue Jun 30 02:22:13 2020        DEPLOYED        nginx-6.0.1     1.19.0          default
</pre>
<p>As you can see that helm v3 is not managing any chart however we do have one chart deployed in helm v2 named mynginx which we are going to migrate to helm v3.</p>
<ul>
<li>Install plugin 2to3 in helm v3 environemnt using below command.</li>
</ul>
<pre class="lang:default decode:true "># helm3 plugin install https://github.com/helm/helm-2to3
Downloading and installing helm-2to3 v0.5.1 ...
https://github.com/helm/helm-2to3/releases/download/v0.5.1/helm-2to3_0.5.1_linux_amd64.tar.gz
Installed plugin: 2to3
# helm3 plugin list
NAME    VERSION DESCRIPTION
2to3    0.5.1   migrate and cleanup Helm v2 configuration and releases in-place to Helm v3
</pre>
<p>To check all the options in 2to3 plugin use help option  as below:</p>
<pre class="lang:default decode:true "># helm3 2to3 help
Migrate and Cleanup Helm v2 configuration and releases in-place to Helm v3

Usage:
  2to3 [command]

Available Commands:
  cleanup     cleanup Helm v2 configuration, release data and Tiller deployment
  convert     migrate Helm v2 release in-place to Helm v3
  help        Help about any command
  move        migrate Helm v2 configuration in-place to Helm v3

Flags:
  -h, --help   help for 2to3

Use "2to3 [command] --help" for more information about a command.
</pre>
<p>As you can see that, there is move command which will migrate helm v2 to helm v3. So lets do config migration to v3.</p>
<ul>
<li>Perform the dry-run of the migration to check which resources or config is going to migrate to helm v3 version using command below:</li>
</ul>
<pre class="lang:default decode:true "># helm3 2to3 move config --dry-run
2020/06/30 02:32:35 NOTE: This is in dry-run mode, the following actions will not be executed.
2020/06/30 02:32:35 Run without --dry-run to take the actions described below:
2020/06/30 02:32:35
2020/06/30 02:32:35 WARNING: Helm v3 configuration may be overwritten during this operation.
2020/06/30 02:32:35
[Move Config/confirm] Are you sure you want to move the v2 configuration? [y/N]: y
2020/06/30 02:32:44
Helm v2 configuration will be moved to Helm v3 configuration.
2020/06/30 02:32:44 [Helm 2] Home directory: /root/.helm
2020/06/30 02:32:44 [Helm 3] Config directory: /root/.config/helm
2020/06/30 02:32:44 [Helm 3] Data directory: /root/.local/share/helm
2020/06/30 02:32:44 [Helm 3] Cache directory: /root/.cache/helm
2020/06/30 02:32:44 [Helm 3] Create config folder "/root/.config/helm" .
2020/06/30 02:32:44 [Helm 2] repositories file "/root/.helm/repository/repositories.yaml" will copy to [Helm 3] config folder "/root/onfig/helm/repositories.yaml" .
2020/06/30 02:32:44 [Helm 3] Create cache folder "/root/.cache/helm" .
2020/06/30 02:32:44 [Helm 3] Create data folder "/root/.local/share/helm" .
2020/06/30 02:32:44 [Helm 2] starters "/root/.helm/starters" will copy to [Helm 3] data folder "/root/.local/share/helm/starters" .
</pre>
<p>As in the above output it has given all the details about migration lets perform the actual migration below command without &#8211;dry-run option.</p>
<pre class="lang:default decode:true "># helm3 2to3 move config
2020/06/30 02:32:56 WARNING: Helm v3 configuration may be overwritten during this operation.
2020/06/30 02:32:56
[Move Config/confirm] Are you sure you want to move the v2 configuration? [y/N]: y
2020/06/30 02:32:57
Helm v2 configuration will be moved to Helm v3 configuration.
2020/06/30 02:32:57 [Helm 2] Home directory: /root/.helm
2020/06/30 02:32:57 [Helm 3] Config directory: /root/.config/helm
2020/06/30 02:32:57 [Helm 3] Data directory: /root/.local/share/helm
2020/06/30 02:32:57 [Helm 3] Cache directory: /root/.cache/helm
2020/06/30 02:32:57 [Helm 3] Create config folder "/root/.config/helm" .
2020/06/30 02:32:57 [Helm 3] Config folder "/root/.config/helm" created.
2020/06/30 02:32:57 [Helm 2] repositories file "/root/.helm/repository/repositories.yaml" will copy to [Helm 3] config folder "/root/onfig/helm/repositories.yaml" .
2020/06/30 02:32:57 [Helm 2] repositories file "/root/.helm/repository/repositories.yaml" copied successfully to [Helm 3] config fold "/root/.config/helm/repositories.yaml" .
2020/06/30 02:32:57 [Helm 3] Create cache folder "/root/.cache/helm" .
2020/06/30 02:32:57 [Helm 3] cache folder "/root/.cache/helm" created.
2020/06/30 02:32:57 [Helm 3] Create data folder "/root/.local/share/helm" .
2020/06/30 02:32:57 [Helm 3] data folder "/root/.local/share/helm" created.
2020/06/30 02:32:57 [Helm 2] starters "/root/.helm/starters" will copy to [Helm 3] data folder "/root/.local/share/helm/starters" .
2020/06/30 02:32:57 [Helm 2] starters "/root/.helm/starters" copied successfully to [Helm 3] data folder "/root/.local/share/helm/staers" .
2020/06/30 02:32:57 Helm v2 configuration was moved successfully to Helm v3 configuration.
</pre>
<p>The above command only migrates the helm v2 to helm v3. In case you want to migrate currently deployed charts from helm v2 to helm v3 you need to use convert command:</p>
<p>Check currently deployed charts in helm v2 using below command:</p>
<pre class="lang:default decode:true "># helm list
NAME    REVISION        UPDATED                         STATUS          CHART           APP VERSION     NAMESPACE
mynginx 1               Tue Jun 30 02:22:13 2020        DEPLOYED        nginx-6.0.1     1.19.0          default
</pre>
<ul>
<li>Migrate the deployed charts</li>
</ul>
<p>For the first we are going to perform dry-run.</p>
<pre class="lang:default decode:true "># helm3 2to3 convert mynginx --dry-run
2020/06/30 02:33:59 NOTE: This is in dry-run mode, the following actions will not be executed.
2020/06/30 02:33:59 Run without --dry-run to take the actions described below:
2020/06/30 02:33:59
2020/06/30 02:33:59 Release "mynginx" will be converted from Helm v2 to Helm v3.
2020/06/30 02:33:59 [Helm 3] Release "mynginx" will be created.
2020/06/30 02:33:59 [Helm 3] ReleaseVersion "mynginx.v1" will be created.</pre>
<p>We are ok with above output as its not given any error or issues while converting the deployed chart to helm v3. Now lets move the deployed resource to helm v3 without &#8211;dry-run option.</p>
<pre class="lang:default decode:true"># helm3 2to3 convert mynginx
2020/06/30 02:34:22 Release "mynginx" will be converted from Helm v2 to Helm v3.
2020/06/30 02:34:22 [Helm 3] Release "mynginx" will be created.
2020/06/30 02:34:22 [Helm 3] ReleaseVersion "mynginx.v1" will be created.
2020/06/30 02:34:23 [Helm 3] ReleaseVersion "mynginx.v1" created.
2020/06/30 02:34:23 [Helm 3] Release "mynginx" created.
2020/06/30 02:34:23 Release "mynginx" was converted successfully from Helm v2 to Helm v3.
2020/06/30 02:34:23 Note: The v2 release information still remains and should be removed to avoid conflicts with the migrated v3 relee.
2020/06/30 02:34:23 v2 release information should only be removed using `helm 2to3` cleanup and when all releases have been migrated er.
</pre>
<p>To confirm migration lets use helm3 list output and also we will check pods, deployments in kubernetes using kubectl.</p>
<pre class="lang:default decode:true "># helm3 list
NAME    NAMESPACE       REVISION        UPDATED                                 STATUS          CHART           APP VERSION
mynginx default         1               2020-06-30 06:22:13.361117663 +0000 UTC deployed        nginx-6.0.1     1.19.0

----------------------------------------------------------------------------------------------------------------------------------------------
# kubectl get all -o wide
NAME                           READY   STATUS    RESTARTS   AGE   IP            NODE        NOMINATED NODE   READINESS GATES
pod/mynginx-5bd8cb6d45-k5vlx   1/1     Running   0          12m   10.244.1.85   kworker01   &lt;none&gt;           &lt;none&gt;

NAME                 TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE   SELECTOR
service/kubernetes   ClusterIP   10.96.0.1        &lt;none&gt;        443/TCP                      28d   &lt;none&gt;
service/mynginx      NodePort    10.103.194.212   &lt;none&gt;        80:30672/TCP,443:30500/TCP   12m   app.kubernetes.io/instance=mynginxpp.kubernetes.io/name=nginx

NAME                      READY   UP-TO-DATE   AVAILABLE   AGE   CONTAINERS   IMAGES                                        SELECTOR
deployment.apps/mynginx   1/1     1            1           12m   nginx        docker.io/bitnami/nginx:1.19.0-debian-10-r2   app.kubertes.io/instance=mynginx,app.kubernetes.io/name=nginx

NAME                                 DESIRED   CURRENT   READY   AGE   CONTAINERS   IMAGES                                        SELTOR
replicaset.apps/mynginx-5bd8cb6d45   1         1         1       12m   nginx        docker.io/bitnami/nginx:1.19.0-debian-10-r2   appubernetes.io/instance=mynginx,app.kubernetes.io/name=nginx,pod-template-hash=5bd8cb6d45
</pre>
<p>The above output confirms that we have successfully migrated deployed charts to helm v3. Now lets remove helm v2 binaries and tiller component and move back helm3 bianary to helm as a final step.</p>
<pre class="lang:default decode:true "># helm3 2to3 cleanup
WARNING: "Helm v2 Configuration" "Release Data" "Tiller" will be removed.
This will clean up all releases managed by Helm v2. It will not be possible to restore them if you haven't made a backup of the releas.
Helm v2 may not be usable afterwards.

[Cleanup/confirm] Are you sure you want to cleanup Helm v2 data? [y/N]: y
2020/06/30 02:35:40
Helm v2 data will be cleaned up.
2020/06/30 02:35:40 [Helm 2] Releases will be deleted.
2020/06/30 02:35:40 [Helm 2] ReleaseVersion "mynginx.v1" will be deleted.
2020/06/30 02:35:41 [Helm 2] ReleaseVersion "mynginx.v1" deleted.
2020/06/30 02:35:41 [Helm 2] Releases deleted.
2020/06/30 02:35:41 [Helm 2] Tiller in "kube-system" namespace will be removed.
2020/06/30 02:35:41 [Helm 2] Tiller "deploy" in "kube-system" namespace will be removed.
2020/06/30 02:35:41 [Helm 2] Tiller "deploy" in "kube-system" namespace was removed successfully.
2020/06/30 02:35:41 [Helm 2] Tiller "service" in "kube-system" namespace will be removed.
2020/06/30 02:35:43 [Helm 2] Tiller "service" in "kube-system" namespace was removed successfully.
2020/06/30 02:35:43 [Helm 2] Tiller in "kube-system" namespace was removed.
2020/06/30 02:35:43 [Helm 2] Home folder "/root/.helm" will be deleted.
2020/06/30 02:35:43 [Helm 2] Home folder "/root/.helm" deleted.
2020/06/30 02:35:43 Helm v2 data was cleaned up successfully.
# helm list
Error: could not find tiller
</pre>
<p>So clean up done successfully also tiller component also terminated which was part of helm v2.</p>
<p>Now remove the helm v2 binary and move helm v3 binary as helm.</p>
<pre class="lang:default decode:true"># rm -rf /usr/local/bin/helm
# mv /usr/local/bin/helm3 /usr/local/bin/helm
# helm list
NAME    NAMESPACE       REVISION        UPDATED                                 STATUS          CHART           APP VERSION
mynginx default         1               2020-06-30 06:22:13.361117663 +0000 UTC deployed        nginx-6.0.1     1.19.0
# helm version --short
v3.2.4+g0ad800e
</pre>
<p>So in this way we can perform migration of helm v2 to helm v3.</p>
<p>&nbsp;</p>
<p>The post <a href="https://linuxroutes.com/how-to-migrate-helm-v2-to-helm-v3/">How to migrate helm v2 to helm v3</a> appeared first on <a href="https://linuxroutes.com">UX Techno</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://linuxroutes.com/how-to-migrate-helm-v2-to-helm-v3/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Helm commands cheat sheet</title>
		<link>https://linuxroutes.com/helm-commands-cheat-sheet/</link>
					<comments>https://linuxroutes.com/helm-commands-cheat-sheet/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 29 Jun 2020 16:51:09 +0000</pubDate>
				<category><![CDATA[devops]]></category>
		<category><![CDATA[Helm]]></category>
		<category><![CDATA[Kubernetes]]></category>
		<guid isPermaLink="false">https://linuxroutes.com/?p=3784</guid>

					<description><![CDATA[<p>This article will explain you about helm commands along with commonly used options. You may treat this article as helm commands cheat sheet.</p>
<p>The post <a href="https://linuxroutes.com/helm-commands-cheat-sheet/">Helm commands cheat sheet</a> appeared first on <a href="https://linuxroutes.com">UX Techno</a>.</p>
]]></description>
										<content:encoded><![CDATA[<hr />
<p>This article will explain you about helm commands along with commonly used options. You may treat this article as helm commands cheat sheet. I have explained widely used helm version 2 command in this article.<a href="https://linuxroutes.com/wp-content/uploads/2020/06/Helm-commands-cheat-sheet.jpg"><img loading="lazy" decoding="async" class="alignright wp-image-3795 size-thumbnail" src="https://linuxroutes.com/wp-content/uploads/2020/06/Helm-commands-cheat-sheet-80x80.jpg" alt="Helm commands cheat sheet" width="80" height="80" srcset="https://linuxroutes.com/wp-content/uploads/2020/06/Helm-commands-cheat-sheet-80x80.jpg 80w, https://linuxroutes.com/wp-content/uploads/2020/06/Helm-commands-cheat-sheet-100x100.jpg 100w" sizes="auto, (max-width: 80px) 100vw, 80px" /></a></p>
<hr />
<p>In case you want to learn about  how to install helm version please follow this <a href="https://linuxroutes.com/how-to-install-helm-in-kubernetes-cluster/" target="_blank" rel="noopener noreferrer">article</a>.</p>
<p>So here the helm commands cheat sheet list for quick go through:</p>
<ul>
<li>
<h2><span style="color: #ff0000;">helm help</span></h2>
</li>
</ul>
<p>In case you want any help on command available with helm.</p>
<pre class="lang:default decode:true "># helm help
</pre>
<p>Lets suppose you want more details about any command option you can use helm help &lt;command&gt; as below. Here in the below case we taken help on search command:</p>
<pre class="lang:default decode:true "># helm help search</pre>
<ul>
<li>
<h2><span style="color: #ff0000;">helm search</span></h2>
</li>
</ul>
<p>In case you want to search for any chart you can helm search command for the same.</p>
<pre class="lang:default decode:true "># helm search phpmyadmin
NAME                    CHART VERSION   APP VERSION     DESCRIPTION
stable/phpmyadmin       4.3.5           5.0.1           DEPRECATED phpMyAdmin is an mysql administration frontend
</pre>
<ul>
<li>
<h2><span style="color: #ff0000;">helm fetch</span></h2>
</li>
</ul>
<p>In case you don&#8217;t want to install the helm chart however you just want to download the chart locally then use helm along with fetch option followed by chart name as below. It will download all chart and template files in the current directory.</p>
<pre class="lang:default decode:true "># helm fetch stable/phpmyadmin
# ls -ltr
total 32
-rw-r--r-- 1 root root 28921 Jun 29 11:04 phpmyadmin-4.3.5.tgz
#
</pre>
<ul>
<li>
<h2><span style="color: #ff0000;">helm install </span></h2>
</li>
</ul>
<p>If you want to install helm chart use install option followed by chart name . You can user &#8211;values option in case you want to use your own values.yaml file. In case you want to give it name to the deployed chart use &#8211;name option as below also chart version could be specified using &#8211;version option as below:</p>
<pre class="lang:default decode:true"># helm install stable/phpmyadmin --name myphpadmin --version 4.3.3
</pre>
<p>The above command also gives overview of the resources deployed by helm in the output. In case you want to check it from the kubernetes front use below command:</p>
<pre class="lang:default decode:true"># kubectl get all |grep -i myphpadmin
pod/myphpadmin-phpmyadmin-76966d4fd-wvf7l   0/1     Running   1          79s
service/myphpadmin-phpmyadmin   ClusterIP   10.99.151.168   &lt;none&gt;        80/TCP    80s
deployment.apps/myphpadmin-phpmyadmin   0/1     1            0           79s
replicaset.apps/myphpadmin-phpmyadmin-76966d4fd   1         1         0       79s
#
</pre>
<ul>
<li>
<h2><span style="color: #ff0000;">helm status </span></h2>
</li>
</ul>
<p>This command will give the curent status of the chart installation. You need to give the name of the chart which is being used in the helm install command as below:</p>
<pre class="lang:default decode:true"># helm status myphpadmin</pre>
<ul>
<li>
<h2><span style="color: #ff0000;">helm list</span></h2>
</li>
</ul>
<p>To list down currently deployed chart use helm list command.</p>
<pre class="lang:default decode:true"># helm list
NAME            REVISION        UPDATED                         STATUS          CHART                   APP VERSION     NAMESPACE
myphpadmin      1               Mon Jun 29 11:35:32 2020        DEPLOYED        phpmyadmin-4.3.3        5.0.1           default
#
</pre>
<ul>
<li>
<h2><span style="color: #ff0000;">helm upgrade </span></h2>
</li>
</ul>
<p>In case you want to upgrade the current version of helm chart, use upgrade command. In our helm install example we installed version 4.3.3 now we will upgrading the chart to 4.3.4 version using below command.</p>
<pre class="lang:default decode:true "># helm upgrade myphpadmin stable/phpmyadmin --version 4.3.4</pre>
<ul>
<li>
<h2><span style="color: #ff0000;">helm history </span></h2>
</li>
</ul>
<p>To check the history of the chart installed use command helm history followed by chartname.</p>
<pre class="lang:default decode:true "># helm history myphpadmin
REVISION        UPDATED                         STATUS          CHART                   APP VERSION     DESCRIPTION
1               Mon Jun 29 11:35:32 2020        SUPERSEDED      phpmyadmin-4.3.3        5.0.1           Install complete
2               Mon Jun 29 11:53:48 2020        DEPLOYED        phpmyadmin-4.3.4        5.0.1           Upgrade complete
#
</pre>
<ul>
<li>
<h2><span style="color: #ff0000;">helm rollback</span></h2>
</li>
</ul>
<p>In case you are not happy with upgraded version and you want to rollback to previous version use helm rollback  along with revision number as below:</p>
<pre class="lang:default decode:true "># helm rollback myphpadmin 1
Rollback was a success.
#
</pre>
<ul>
<li>
<h2><span style="color: #ff0000;">helm delete </span></h2>
</li>
</ul>
<p>To delete the installed chart use helm delete command as below:</p>
<pre class="lang:default decode:true "># helm delete myphpadmin
release "myphpadmin" deleted
#
</pre>
<ul>
<li>
<h2><span style="color: #ff0000;">helm repo list</span></h2>
</li>
</ul>
<p>To list down currently used repositories use helm repo list command.</p>
<pre class="lang:default decode:true "># helm repo list
NAME    URL
stable  https://kubernetes-charts.storage.googleapis.com
local   http://127.0.0.1:8879/charts
#
</pre>
<ul>
<li>
<h2><span style="color: #ff0000;">helm repo update</span></h2>
</li>
</ul>
<p>To update repositories use helm repo update command.</p>
<pre class="lang:default decode:true "># helm repo update
Hang tight while we grab the latest from your chart repositories...
...Skip local chart repository
...Successfully got an update from the "stable" chart repository
Update Complete.
#
</pre>
<ul>
<li>
<h2><span style="color: #ff0000;">helm reset</span></h2>
</li>
</ul>
<p>If you want to uninstall the tiller component use command  helm reset along with option &#8220;&#8211;remove-helm-home&#8221; in case you want to remove the home directory of the helm. Also -f option to do it forcefully.</p>
<pre class="lang:default decode:true "># helm reset -f --remove-helm-home
Deleting /root/.helm
Tiller (the Helm server-side component) has been uninstalled from your Kubernetes Cluster.
#
</pre>
<p>To explore more commands follow this <a href="https://helm.sh/docs/helm/" target="_blank" rel="noopener noreferrer">link</a>.</p>
<p>&nbsp;</p>
<p>The post <a href="https://linuxroutes.com/helm-commands-cheat-sheet/">Helm commands cheat sheet</a> appeared first on <a href="https://linuxroutes.com">UX Techno</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://linuxroutes.com/helm-commands-cheat-sheet/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to install helm in kubernetes cluster</title>
		<link>https://linuxroutes.com/how-to-install-helm-in-kubernetes-cluster/</link>
					<comments>https://linuxroutes.com/how-to-install-helm-in-kubernetes-cluster/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 27 Jun 2020 11:44:49 +0000</pubDate>
				<category><![CDATA[devops]]></category>
		<category><![CDATA[Kubernetes]]></category>
		<category><![CDATA[how to install helm]]></category>
		<category><![CDATA[how to install helm in kubernetes]]></category>
		<guid isPermaLink="false">https://linuxroutes.com/?p=3772</guid>

					<description><![CDATA[<p>This article will guide you on how to install helm in kubernetes cluster.</p>
<p>The post <a href="https://linuxroutes.com/how-to-install-helm-in-kubernetes-cluster/">How to install helm in kubernetes cluster</a> appeared first on <a href="https://linuxroutes.com">UX Techno</a>.</p>
]]></description>
										<content:encoded><![CDATA[<hr />
<p>This article will guide you on how to install helm in kubernetes cluster. You might be aware that Helm is the package manger that can be deployed in kubernetes.<a href="https://linuxroutes.com/wp-content/uploads/2020/06/How-to-install-helm-in-kubernetes-cluster.jpg"><img loading="lazy" decoding="async" class="size-thumbnail wp-image-3781 alignright" src="https://linuxroutes.com/wp-content/uploads/2020/06/How-to-install-helm-in-kubernetes-cluster-80x80.jpg" alt="How to install helm" width="80" height="80" srcset="https://linuxroutes.com/wp-content/uploads/2020/06/How-to-install-helm-in-kubernetes-cluster-80x80.jpg 80w, https://linuxroutes.com/wp-content/uploads/2020/06/How-to-install-helm-in-kubernetes-cluster-100x100.jpg 100w" sizes="auto, (max-width: 80px) 100vw, 80px" /></a></p>
<hr />
<p>Using Helm you can deploy application and manage them easily.To read more about the helm please follow this <a href="https://helm.sh/" target="_blank" rel="noopener noreferrer">link</a>.</p>
<p>To show case the demo, we are going to install helm version 2 so that later may be we can see other post which can guide us on how to migrate to helm version 3.</p>
<p>Steps:</p>
<ul>
<li>Create the service account required.</li>
</ul>
<pre class="lang:default decode:true "># kubectl create serviceaccount --namespace kube-system tiller
serviceaccount/tiller created</pre>
<ul>
<li> Create the cluster role binding in the cluster.</li>
</ul>
<pre class="lang:default decode:true "># kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
clusterrolebinding.rbac.authorization.k8s.io/tiller created</pre>
<ul>
<li>Download the helm binaries and extract it. In this case we are installing helm version 2.16.9</li>
</ul>
<pre class="lang:default decode:true "># wget https://get.helm.sh/helm-v2.16.9-linux-amd64.tar.gz
# tar -zxvf helm-v2.16.9-linux-amd64.tar.gz
# cd linux-amd64/
# ls -ltr
total 78672
-rwxr-xr-x 1 root root 39919616 Jun 16 14:17 helm
-rwxr-xr-x 1 root root 40615936 Jun 16 14:20 tiller
-rw-r--r-- 1 root root     3444 Jun 16 14:20 README.md
-rw-r--r-- 1 root root    11343 Jun 16 14:20 LICENSE</pre>
<ul>
<li>Now move the helm binary to /usr/local/bin</li>
</ul>
<pre class="lang:default decode:true "># mv helm /usr/local/bin/helm</pre>
<ul>
<li>Check the version of the helm.</li>
</ul>
<pre class="lang:default decode:true "># which helm
/usr/local/bin/helm
# helm version
Client: &amp;version.Version{SemVer:"v2.16.9", GitCommit:"8ad7037828e5a0fca1009dabe290130da6368e39", GitTreeState:"clean"}
Error: could not find tiller
# helm version --short
Client: v2.16.9+g8ad7037</pre>
<ul>
<li>Initialize the helm using helm init command as below.</li>
</ul>
<pre class="lang:default decode:true"># helm init --service-account tiller
Creating /root/.helm
Creating /root/.helm/repository
Creating /root/.helm/repository/cache
Creating /root/.helm/repository/local
Creating /root/.helm/plugins
Creating /root/.helm/starters
Creating /root/.helm/cache/archive
Creating /root/.helm/repository/repositories.yaml
Adding stable repo with URL: https://kubernetes-charts.storage.googleapis.com
Adding local repo with URL: http://127.0.0.1:8879/charts
$HELM_HOME has been configured at /root/.helm.

Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster.

Please note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy.
To prevent this, run `helm init` with the --tiller-tls-verify flag.
For more information on securing your installation see: https://v2.helm.sh/docs/securing_installation/</pre>
<ul>
<li>Cross check that tiller is running fine in the kubernetes using below command.</li>
</ul>
<pre class="lang:default decode:true"># kubectl -n kube-system get pod,deploy|grep -i tiller
pod/tiller-deploy-8488d98b4c-9xpbg    1/1     Running   0          14s
deployment.apps/tiller-deploy   1/1     1            1           14s</pre>
<ul>
<li>Once you see that tiller is running fine fire helm list command to cross verify. In the beginning it will show blank output.</li>
</ul>
<pre class="lang:default decode:true "># helm list</pre>
<p>Some other commands to cross verify your helm:</p>
<pre class="lang:default decode:true"># helm search jenkins
NAME            CHART VERSION APP VERSION       DESCRIPTION
stable/jenkins  2.1.0         lts               Open source continuous integration server. It supports mu...
# helm home
/root/.helm
# helm version --short
Client: v2.16.9+g8ad7037
Server: v2.16.9+g8ad7037
# helm repo list
NAME    URL
stable  https://kubernetes-charts.storage.googleapis.com
local   http://127.0.0.1:8879/charts</pre>
<p>In case you want to install jenkins use below command:</p>
<pre class="lang:default decode:true "># helm install stable/jenkins</pre>
<p>Once installed you can list down it using below helm list command:</p>
<pre class="lang:default decode:true "># helm list
NAME         REVISION   UPDATED                  STATUS      CHART             APP VERSION  NAMESPACE
khaki-kitten 1          Thu Jun 25 02:05:27 2020 DEPLOYED    jenkins-2.1.0     lts          default</pre>
<p>So this is all about &#8220;<strong>How to install helm</strong>&#8221; in kubernetes and cross-verify it for successful installation.</p>
<p>The post <a href="https://linuxroutes.com/how-to-install-helm-in-kubernetes-cluster/">How to install helm in kubernetes cluster</a> appeared first on <a href="https://linuxroutes.com">UX Techno</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://linuxroutes.com/how-to-install-helm-in-kubernetes-cluster/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
