blob: dff4fda060ac64a041d019282865a4bd37a6fade [file] [log] [blame]
<!DOCTYPE html>
<html lang="stable" class="js csstransforms3d">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Hugo 0.54.0" />
<meta name="description" content="A set of micro-services for connecting millions of devices.">
<meta name="author" content="The Eclipse Hono Project">
<link rel="apple-touch-icon" sizes="180x180" href="/hono/docs/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="48x48" href="/hono/docs/favicon/favicon-48x48.png">
<link rel="icon" type="image/png" sizes="32x32" href="/hono/docs/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/hono/docs/favicon/favicon-16x16.png">
<link rel="manifest" href="/hono/docs/favicon/site.webmanifest">
<link rel="mask-icon" href="/hono/docs/favicon/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="/hono/docs/favicon/favicon.ico">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-config" content="/hono/docs/favicon/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<title>Setting up a Kubernetes Cluster :: Eclipse Hono&trade;</title>
<link href="/hono/docs/css/nucleus.css?1568942604" rel="stylesheet">
<link href="/hono/docs/css/fontawesome-all.min.css?1568942604" rel="stylesheet">
<link href="/hono/docs/css/hybrid.css?1568942604" rel="stylesheet">
<link href="/hono/docs/css/featherlight.min.css?1568942604" rel="stylesheet">
<link href="/hono/docs/css/perfect-scrollbar.min.css?1568942604" rel="stylesheet">
<link href="/hono/docs/css/auto-complete.css?1568942604" rel="stylesheet">
<link href="/hono/docs/css/theme.css?1568942604" rel="stylesheet">
<link href="/hono/docs/css/hugo-theme.css?1568942604" rel="stylesheet">
<link href="/hono/docs/css/theme-hono.css?1568942604" rel="stylesheet">
<script src="/hono/docs/js/jquery-2.x.min.js?1568942604"></script>
<style type="text/css">
:root #header + #content > #left > #rlblock_left{
display:none !important;
}
:not(pre) > code + span.copy-to-clipboard {
display: none;
}
</style>
<link rel="stylesheet" href="https://www.eclipse.org/eclipse.org-common/themes/solstice/public/stylesheets/vendor/cookieconsent/cookieconsent.min.css">
<link rel="stylesheet" href='/hono/docs/css/hono.css'>
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@EclipseHono">
<meta name="twitter:title" content="Setting up a Kubernetes Cluster :: Eclipse Hono&amp;trade;">
<meta name="twitter:image" content="https://www.eclipse.org/hono/docs/images/twitter_image.png">
<meta name="twitter:description" content="A set of micro-services for connecting millions of devices.">
<meta property="og:title" content="Setting up a Kubernetes Cluster :: Eclipse Hono&amp;trade;" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://www.eclipse.org/hono/docs/deployment/create-kubernetes-cluster//" />
<meta property="og:image" content="https://www.eclipse.org/hono/docs/images/twitter_image.png" />
</head>
<body class="" data-url="/hono/docs/deployment/create-kubernetes-cluster/">
<nav id="sidebar" class="">
<div id="header-wrapper">
<div id="header">
<a href="https://www.eclipse.org/hono">
<img src="/hono/docs/images/HONO-Logo_Bild-Wort_quer-w-310x120px.svg" alt="Hono logo" class="logo-img">
</a>
</div>
<div class="searchbox">
<label for="search-by"><i class="fas fa-search"></i></label>
<input data-search-input id="search-by" type="search" placeholder="Search...">
<span data-search-clear=""><i class="fas fa-times"></i></span>
</div>
<script type="text/javascript" src="/hono/docs/js/lunr.min.js?1568942604"></script>
<script type="text/javascript" src="/hono/docs/js/auto-complete.js?1568942604"></script>
<script type="text/javascript">
var baseurl = "https:\/\/www.eclipse.org\/hono\/docs\/";
</script>
<script type="text/javascript" src="/hono/docs/js/search.js?1568942604"></script>
</div>
<div class="highlightable">
<ul class="topics">
<li data-nav-id="/hono/docs/concepts/" title="Concepts" class="dd-item
">
<a href="/hono/docs/concepts/">
<i class="far fa-lightbulb"></i> Concepts
</a>
<ul>
<li data-nav-id="/hono/docs/concepts/device-identity/" title="Device Identity" class="dd-item ">
<a href="/hono/docs/concepts/device-identity/">
Device Identity
</a>
</li>
<li data-nav-id="/hono/docs/concepts/tenancy/" title="Multi-Tenancy" class="dd-item ">
<a href="/hono/docs/concepts/tenancy/">
Multi-Tenancy
</a>
</li>
<li data-nav-id="/hono/docs/concepts/device-notifications/" title="Device Notifications" class="dd-item ">
<a href="/hono/docs/concepts/device-notifications/">
Device Notifications
</a>
</li>
<li data-nav-id="/hono/docs/concepts/command-and-control/" title="Command &amp; Control" class="dd-item ">
<a href="/hono/docs/concepts/command-and-control/">
Command &amp; Control
</a>
</li>
<li data-nav-id="/hono/docs/concepts/resource-limits/" title="Resource limits" class="dd-item ">
<a href="/hono/docs/concepts/resource-limits/">
Resource limits
</a>
</li>
<li data-nav-id="/hono/docs/concepts/connection-events/" title="Connection Events" class="dd-item ">
<a href="/hono/docs/concepts/connection-events/">
Connection Events
</a>
</li>
</ul>
</li>
<li data-nav-id="/hono/docs/user-guide/" title="User Guide" class="dd-item
">
<a href="/hono/docs/user-guide/">
<i class="fas fa-book-reader"></i> User Guide
</a>
<ul>
<li data-nav-id="/hono/docs/user-guide/device-registry/" title="Device Registry" class="dd-item ">
<a href="/hono/docs/user-guide/device-registry/">
Device Registry
</a>
</li>
<li data-nav-id="/hono/docs/user-guide/http-adapter/" title="HTTP Adapter" class="dd-item ">
<a href="/hono/docs/user-guide/http-adapter/">
HTTP Adapter
</a>
</li>
<li data-nav-id="/hono/docs/user-guide/mqtt-adapter/" title="MQTT Adapter" class="dd-item ">
<a href="/hono/docs/user-guide/mqtt-adapter/">
MQTT Adapter
</a>
</li>
<li data-nav-id="/hono/docs/user-guide/amqp-adapter/" title="AMQP Adapter" class="dd-item ">
<a href="/hono/docs/user-guide/amqp-adapter/">
AMQP Adapter
</a>
</li>
<li data-nav-id="/hono/docs/user-guide/kura-adapter/" title="Kura Adapter" class="dd-item ">
<a href="/hono/docs/user-guide/kura-adapter/">
Kura Adapter
</a>
</li>
<li data-nav-id="/hono/docs/user-guide/sigfox-adapter/" title="Sigfox Adapter" class="dd-item ">
<a href="/hono/docs/user-guide/sigfox-adapter/">
Sigfox Adapter
</a>
</li>
<li data-nav-id="/hono/docs/user-guide/jmeter_load_tests/" title="Load Tests with JMeter" class="dd-item ">
<a href="/hono/docs/user-guide/jmeter_load_tests/">
Load Tests with JMeter
</a>
</li>
</ul>
</li>
<li data-nav-id="/hono/docs/admin-guide/" title="Admin Guide" class="dd-item
">
<a href="/hono/docs/admin-guide/">
<i class="fas fa-sliders-h"></i> Admin Guide
</a>
<ul>
<li data-nav-id="/hono/docs/admin-guide/common-config/" title="Common Configuration" class="dd-item ">
<a href="/hono/docs/admin-guide/common-config/">
Common Configuration
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/auth-server-config/" title="Auth Server Configuration" class="dd-item ">
<a href="/hono/docs/admin-guide/auth-server-config/">
Auth Server Configuration
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/device-registry-config/" title="Device Registry Configuration" class="dd-item ">
<a href="/hono/docs/admin-guide/device-registry-config/">
Device Registry Configuration
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/device-connection-config/" title="Configuring the Device Connection Service" class="dd-item ">
<a href="/hono/docs/admin-guide/device-connection-config/">
Device Connection Service Configuration
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/http-adapter-config/" title="HTTP Adapter Configuration" class="dd-item ">
<a href="/hono/docs/admin-guide/http-adapter-config/">
HTTP Adapter Configuration
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/amqp-adapter-config/" title="AMQP Adapter Configuration" class="dd-item ">
<a href="/hono/docs/admin-guide/amqp-adapter-config/">
AMQP Adapter Configuration
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/mqtt-adapter-config/" title="MQTT Adapter Configuration" class="dd-item ">
<a href="/hono/docs/admin-guide/mqtt-adapter-config/">
MQTT Adapter Configuration
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/kura-adapter-config/" title="Kura Adapter Configuration" class="dd-item ">
<a href="/hono/docs/admin-guide/kura-adapter-config/">
Kura Adapter Configuration
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/hono-client-configuration/" title="Hono Client Configuration" class="dd-item ">
<a href="/hono/docs/admin-guide/hono-client-configuration/">
Hono Client Configuration
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/amqp-network-config/" title="AMQP 1.0 Messaging Network Configuration" class="dd-item ">
<a href="/hono/docs/admin-guide/amqp-network-config/">
AMQP 1.0 Messaging Network Configuration
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/secure_communication/" title="Secure Communication" class="dd-item ">
<a href="/hono/docs/admin-guide/secure_communication/">
Secure Communication
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/monitoring-tracing-config/" title="Monitoring &amp; Tracing" class="dd-item ">
<a href="/hono/docs/admin-guide/monitoring-tracing-config/">
Monitoring &amp; Tracing
</a>
</li>
</ul>
</li>
<li data-nav-id="/hono/docs/dev-guide/" title="Developer Guide" class="dd-item
">
<a href="/hono/docs/dev-guide/">
<i class="fas fa-tools"></i> Developer Guide
</a>
<ul>
<li data-nav-id="/hono/docs/dev-guide/building_hono/" title="Building from Source" class="dd-item ">
<a href="/hono/docs/dev-guide/building_hono/">
Building from Source
</a>
</li>
<li data-nav-id="/hono/docs/dev-guide/java_client_consumer/" title="Consuming Messages from Java" class="dd-item ">
<a href="/hono/docs/dev-guide/java_client_consumer/">
Consuming Messages from Java
</a>
</li>
<li data-nav-id="/hono/docs/dev-guide/custom_http_adapter/" title="Implement a Custom Hono HTTP Protocol Adapter" class="dd-item ">
<a href="/hono/docs/dev-guide/custom_http_adapter/">
Implement a Custom Hono HTTP Protocol Adapter
</a>
</li>
</ul>
</li>
<li data-nav-id="/hono/docs/api/" title="API" class="dd-item
">
<a href="/hono/docs/api/">
&nbsp;<i class='fas fa-plug'></i>&nbsp;API
</a>
<ul>
<li data-nav-id="/hono/docs/api/telemetry/" title="Telemetry API Specification" class="dd-item ">
<a href="/hono/docs/api/telemetry/">
Telemetry API
</a>
</li>
<li data-nav-id="/hono/docs/api/event/" title="Event API Specification" class="dd-item ">
<a href="/hono/docs/api/event/">
Event API
</a>
</li>
<li data-nav-id="/hono/docs/api/command-and-control/" title="Command &amp; Control API Specification" class="dd-item ">
<a href="/hono/docs/api/command-and-control/">
Command &amp; Control API
</a>
</li>
<li data-nav-id="/hono/docs/api/tenant/" title="Tenant API Specification" class="dd-item ">
<a href="/hono/docs/api/tenant/">
Tenant API
</a>
</li>
<li data-nav-id="/hono/docs/api/device-connection/" title="Device Connection API Specification" class="dd-item ">
<a href="/hono/docs/api/device-connection/">
Device Connection API
</a>
</li>
<li data-nav-id="/hono/docs/api/device-registration/" title="Device Registration API Specification" class="dd-item ">
<a href="/hono/docs/api/device-registration/">
Device Registration API
</a>
</li>
<li data-nav-id="/hono/docs/api/credentials/" title="Credentials API Specification" class="dd-item ">
<a href="/hono/docs/api/credentials/">
Credentials API
</a>
</li>
<li data-nav-id="/hono/docs/api/authentication/" title="Authentication API Specification" class="dd-item ">
<a href="/hono/docs/api/authentication/">
Authentication API
</a>
</li>
<li data-nav-id="/hono/docs/api/management/" title="Device Registry Management API Specification" class="dd-item ">
<a href="/hono/docs/api/management/">
Device Registry Management API
</a>
</li>
<li data-nav-id="/hono/docs/api/metrics/" title="Metrics" class="dd-item ">
<a href="/hono/docs/api/metrics/">
Metrics
</a>
</li>
</ul>
</li>
<li data-nav-id="/hono/docs/deployment/" title="Deployment" class="dd-item
parent
">
<a href="/hono/docs/deployment/">
<i class="fas fa-shipping-fast"></i> Deployment
</a>
<ul>
<li data-nav-id="/hono/docs/deployment/helm-based-deployment/" title="Helm based Deployment" class="dd-item ">
<a href="/hono/docs/deployment/helm-based-deployment/">
Helm based Deployment
</a>
</li>
<li data-nav-id="/hono/docs/deployment/openshift/" title="OpenShift / OKD" class="dd-item ">
<a href="/hono/docs/deployment/openshift/">
OpenShift / OKD
</a>
</li>
<li data-nav-id="/hono/docs/deployment/create-kubernetes-cluster/" title="Setting up a Kubernetes Cluster" class="dd-item active">
<a href="/hono/docs/deployment/create-kubernetes-cluster/">
Setting up a Kubernetes Cluster
</a>
</li>
<li data-nav-id="/hono/docs/deployment/resource-limitation/" title="Limiting Resource Usage" class="dd-item ">
<a href="/hono/docs/deployment/resource-limitation/">
Limiting Resource Usage
</a>
</li>
</ul>
</li>
<li data-nav-id="/hono/docs/architecture/" title="Architecture" class="dd-item
">
<a href="/hono/docs/architecture/">
<i class="fas fa-landmark"></i> Architecture
</a>
<ul>
<li data-nav-id="/hono/docs/architecture/component-view/" title="Component View" class="dd-item ">
<a href="/hono/docs/architecture/component-view/">
Component View
</a>
</li>
<li data-nav-id="/hono/docs/architecture/auth/" title="Authentication/Authorization" class="dd-item ">
<a href="/hono/docs/architecture/auth/">
Authentication/Authorization
</a>
</li>
</ul>
</li>
</ul>
<section id="prefooter">
<hr/>
<ul>
<li>
<div id="select-box-wrapper">
<div id="select-box">
<a class="padding">
Version:&nbsp;
<div class="select-style">
<select id="select-language" onchange="location = this.value;">
<option id="stable" value="/hono/docs/deployment/create-kubernetes-cluster/" selected>stable (1.0-M7)</option>
<option id="dev" value="/hono/docs/dev/deployment/create-kubernetes-cluster/">dev</option>
</select>
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="255px" height="255px" viewBox="0 0 255 255" style="enable-background:new 0 0 255 255;" xml:space="preserve">
<g>
<g id="arrow-drop-down">
<polygon points="0,63.75 127.5,191.25 255,63.75 " />
</g>
</g>
</svg>
</div>
</a>
</div>
</div>
</li>
</ul>
</section>
<section id="footer">
<p>&copy; 2019 <a href="https://www.eclipse.org/hono">The Eclipse Hono Project</a></p>
<p>
Documentation built with
<a href="https://www.gohugo.io" target="_blank">Hugo</a>
using the
<a href="https://github.com/matcornic/hugo-theme-learn" target="_blank">Learn</a> theme.
</p>
<div class="eclipse-logo">
<a href="https://www.eclipse.org" target="_blank">
<img src="https://www.eclipse.org/hono/docs/images/eclipse_foundation_logo.svg"/>
</a>
</div>
</section>
</div>
</nav>
<section id="body">
<div id="overlay"></div>
<div class="padding highlightable">
<div>
<div id="top-bar">
<div id="top-github-link">
<a class="github-link" title='Edit this page' href="https://github.com/eclipse/hono/edit/master/site/documentation/content/deployment/create-kubernetes-cluster.md" target="blank">
<i class="fas fa-code-branch"></i>
<span id="top-github-link-text">Edit this page</span>
</a>
</div>
<div id="breadcrumbs" itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb">
<span id="sidebar-toggle-span">
<a href="#" id="sidebar-toggle" data-sidebar-toggle="">
<i class="fas fa-bars"></i>
</a>
</span>
<span id="toc-menu"><i class="fas fa-list-alt"></i></span>
<span class="links">
<a href='/hono/docs/'>Documentation</a> > <a href='/hono/docs/deployment/'>Deployment</a> > Setting up a Kubernetes Cluster
</span>
</div>
<div class="progress">
<div class="wrapper">
<nav id="TableOfContents">
<ul>
<li>
<ul>
<li><a href="#setting-up-a-local-development-environment">Setting up a local Development Environment</a></li>
<li><a href="#setting-up-a-production-environment">Setting up a Production Environment</a></li>
<li><a href="#setting-up-a-cluster-using-azure-kubernetes-service">Setting up a Cluster using Azure Kubernetes Service</a>
<ul>
<li><a href="#prepare-environment">Prepare Environment</a>
<ul>
<li><a href="#install-azure-cli">Install azure cli</a></li>
<li><a href="#install-kubectl">Install Kubectl</a></li>
<li><a href="#log-in-to-azure">Log in to Azure</a></li>
<li><a href="#create-resource-group-for-hono-deployment">Create Resource Group for Hono Deployment</a></li>
<li><a href="#create-private-container-registry-on-azure">Create private Container Registry on Azure</a></li>
<li><a href="#log-in-to-container-registry">Log in to Container Registry</a></li>
</ul></li>
<li><a href="#create-azure-kubernetes-service-cluster">Create Azure Kubernetes Service Cluster</a>
<ul>
<li><a href="#create-service-principal">Create Service Principal</a></li>
<li><a href="#create-cluster">Create Cluster</a></li>
<li><a href="#set-cluster-as-current-context-for-kubectl">Set Cluster as current Context for kubectl</a></li>
<li><a href="#create-clusterrolebinding-for-kubernetes-dashboard">Create ClusterRoleBinding for Kubernetes dashboard</a></li>
<li><a href="#deploy-helm-s-tiller-service">Deploy Helm&rsquo;s Tiller Service</a></li>
<li><a href="#grant-aks-cluster-access-to-container-registry">Grant AKS Cluster access to Container Registry</a></li>
<li><a href="#optional-create-retain-storageclass-for-the-device-registry">(Optional) Create retain StorageClass for the Device Registry</a></li>
</ul></li>
<li><a href="#monitoring">Monitoring</a></li>
<li><a href="#cleaning-up">Cleaning up</a></li>
<li><a href="#links">Links</a></li>
</ul></li>
</ul></li>
</ul>
</nav>
</div>
</div>
</div>
</div>
<div id="body-inner">
<h1>Setting up a Kubernetes Cluster</h1>
<p>This guide describes how to set up a Kubernetes cluster which can be used to run Eclipse Hono.</p>
<p>Hono can be deployed to any Kubernetes cluster running version 1.11 or newer. This includes <a href="https://www.okd.io/">OpenShift (Origin)</a> which is built on top of Kubernetes.</p>
<p>The <a href="https://kubernetes.io/docs/setup/">Kubernetes web site</a> provides instructions for setting up a (local) cluster on bare metal and/or virtual infrastructure from scratch or for provisioning a managed Kubernetes cluster from one of the popular cloud providers.</p>
<p><a name="Local Development"></a></p>
<h2 id="setting-up-a-local-development-environment">Setting up a local Development Environment</h2>
<p>The easiest option is to set up a single-node cluster running on a local VM using the <a href="https://github.com/kubernetes/minikube">Minikube</a> project.
This kind of setup is sufficient for evaluation and development purposes.
Please refer to Kubernetes&rsquo; <a href="https://kubernetes.io/docs/setup/minikube/">Minikube setup guide</a> for instructions on how to set up a cluster locally.</p>
<p>The recommended settings for a Minikube VM used for running Hono&rsquo;s example setup are as follows:</p>
<ul>
<li><strong>cpus</strong>: 2</li>
<li><strong>memory</strong>: 8192 (MB)</li>
</ul>
<p>The command to start the VM will look something like this:</p>
<pre><code class="language-sh">minikube start --cpus 2 --memory 8192
</code></pre>
<p>After the Minikube VM has started successfully, the <code>minikube tunnel</code> command should be run in order to support Hono&rsquo;s services being deployed using the <em>LoadBalancer</em> type. Please refer to the <a href="https://github.com/kubernetes/minikube/blob/master/docs/networking.md#access-to-loadbalancer-services-using-minikube-tunnel">Minikube Networking docs</a> for details.</p>
<div class="alert alert-notice">
<h4 class="alert-heading"><i class="fas fa-info-circle"></i> Supported Kubernetes Versions</h4>
<div>Minikube will use the most recent Kubernetes version that was available when it has been compiled by default. Hono <em>should</em> run on any version of Kubernetes starting with 1.13.6. However, it has been tested with several specific versions only so if you experience any issues with running Hono on a more recent version, please try to deploy to 1.13.6 before
raising an issue. You can use Minikube&rsquo;s <code>--kubernetes-version</code> command line switch to set a particular version.</div>
</div>
<h2 id="setting-up-a-production-environment">Setting up a Production Environment</h2>
<p>Setting up a multi-node Kubernetes cluster is a more advanced topic. Please follow the corresponding links provided in the <a href="https://kubernetes.io/docs/setup/#production-environment">Kubernetes documentation</a>.</p>
<h2 id="setting-up-a-cluster-using-azure-kubernetes-service">Setting up a Cluster using Azure Kubernetes Service</h2>
<p>The following sections provide step-by-step instructions for setting up a Kubernetes cluster on Microsoft Azure that can be used to run Hono.</p>
<h3 id="prepare-environment">Prepare Environment</h3>
<p>At this step we expect you have clean Ubuntu VM or PC (tested on Ubuntu 18.04.2 LTS (GNU/Linux 4.18.0-1013-azure x86_64))</p>
<h4 id="install-azure-cli">Install azure cli</h4>
<pre><code class="language-sh">sudo apt-get update
sudo apt-get install curl apt-transport-https lsb-release gpg
curl -sL https://packages.microsoft.com/keys/microsoft.asc | \
gpg --dearmor | \
sudo tee /etc/apt/trusted.gpg.d/microsoft.asc.gpg &gt; /dev/null
AZ_REPO=$(lsb_release -cs)
echo &quot;deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main&quot; | \
sudo tee /etc/apt/sources.list.d/azure-cli.list
sudo apt-get update
sudo apt-get install azure-cli
</code></pre>
<h4 id="install-kubectl">Install Kubectl</h4>
<p>The kubectl tool is used to manage a Kubernetes cluster from the command line.
Follow the <a href="https://kubernetes.io/docs/tasks/tools/install-kubectl/">installation guide</a> in order to set up <code>kubectl</code> on your local machine.</p>
<h4 id="log-in-to-azure">Log in to Azure</h4>
<p>Type</p>
<pre><code class="language-sh">az login
</code></pre>
<p>and follow instructions on screen.</p>
<p>A result of successful log in will be a JSON output with subscription details. Run the following command, using the subscription <em>id</em> from the JSON structure:</p>
<pre><code class="language-sh">az account set -s &quot;{YOUR SUBSCRIPTION ID}&quot;
</code></pre>
<p>Before we continue, let&rsquo;s setup some variables, that will be used to create resources on Azure:</p>
<pre><code class="language-sh"># Name of your Resource Group, where all services will be deployed
AKS_RESOURCE_GROUP={YOUR-RG-NAME}
# Name of your AKS cluster
AKS_CLUSTER_NAME={YOUR-AKS-NAME}
# Name of your private container registry (should match ^[a-zA-Z0-9]*$)
ACR_NAME={YOUR-ACR-NAME}
</code></pre>
<h4 id="create-resource-group-for-hono-deployment">Create Resource Group for Hono Deployment</h4>
<pre><code class="language-sh">az group create --name $AKS_RESOURCE_GROUP --location westeurope
</code></pre>
<h4 id="create-private-container-registry-on-azure">Create private Container Registry on Azure</h4>
<pre><code class="language-sh">az acr create --resource-group $AKS_RESOURCE_GROUP --name $ACR_NAME --sku Basic
</code></pre>
<p>The full name of the private container registry will be <code>$ACR_NAME.azurecr.io</code>. This name needs to be used with the <code>docker push</code> command when pushing container images to the registry.</p>
<h4 id="log-in-to-container-registry">Log in to Container Registry</h4>
<pre><code class="language-sh">sudo az acr login --name $ACR_NAME
</code></pre>
<h3 id="create-azure-kubernetes-service-cluster">Create Azure Kubernetes Service Cluster</h3>
<p>Now it&rsquo;s time to create the AKS cluster.</p>
<h4 id="create-service-principal">Create Service Principal</h4>
<pre><code class="language-sh">az ad sp create-for-rbac --skip-assignment
</code></pre>
<p>If successful, <em>appId</em> and <em>password</em> will be displayed.</p>
<h4 id="create-cluster">Create Cluster</h4>
<pre><code class="language-sh"># It is recommended to use kubernetes 1.12.5 or higher
# To list available versions run:
# az aks get-versions --location westeurope --output table
az aks create --name $AKS_CLUSTER_NAME --resource-group $AKS_RESOURCE_GROUP --node-count 3 --generate-ssh-keys --service-principal &quot;{appId}&quot; --client-secret &quot;{password}&quot; --enable-addons monitoring --kubernetes-version 1.13.5
</code></pre>
<h4 id="set-cluster-as-current-context-for-kubectl">Set Cluster as current Context for kubectl</h4>
<pre><code class="language-sh">az aks get-credentials --resource-group $AKS_RESOURCE_GROUP --name $AKS_CLUSTER_NAME
</code></pre>
<h4 id="create-clusterrolebinding-for-kubernetes-dashboard">Create ClusterRoleBinding for Kubernetes dashboard</h4>
<pre><code class="language-sh"># By default, AKS is deployed with RBAC enabled. Refer to this doc: https://docs.microsoft.com/en-us/azure/aks/kubernetes-dashboard
kubectl create clusterrolebinding kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard
</code></pre>
<h4 id="deploy-helm-s-tiller-service">Deploy Helm&rsquo;s Tiller Service</h4>
<pre><code class="language-sh">kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account tiller
</code></pre>
<h4 id="grant-aks-cluster-access-to-container-registry">Grant AKS Cluster access to Container Registry</h4>
<pre><code class="language-sh"># Get the id of the service principal configured for AKS
CLIENT_ID=$(az aks show --resource-group $AKS_RESOURCE_GROUP --name $AKS_CLUSTER_NAME --query &quot;servicePrincipalProfile.clientId&quot; --output tsv)
# Get the ACR registry resource id
ACR_ID=$(az acr show --name $ACR_NAME --resource-group $AKS_RESOURCE_GROUP --query &quot;id&quot; --output tsv)
# Create role assignment
az role assignment create --assignee $CLIENT_ID --role acrpull --scope $ACR_ID
</code></pre>
<h4 id="optional-create-retain-storageclass-for-the-device-registry">(Optional) Create retain StorageClass for the Device Registry</h4>
<p>With the <a href="https://docs.microsoft.com/en-us/azure/aks/concepts-storage">reclaim policy retain</a> AKS ensures that your storage persists even through Hono redeployments.</p>
<p>Create a file <code>managed-premium-retain.yaml</code> with the following content.</p>
<pre><code class="language-yaml">kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: managed-premium-retain
provisioner: kubernetes.io/azure-disk
reclaimPolicy: Retain
parameters:
storageaccounttype: Premium_LRS
kind: Managed
</code></pre>
<p>Now apply to your AKS cluster:</p>
<pre><code class="language-shell">kubectl apply -f managed-premium-retain.yaml
</code></pre>
<p>Note: in your helm deployment later you have to set the value <code>deviceRegistry.storageClass=managed-premium-retain</code>.</p>
<h3 id="monitoring">Monitoring</h3>
<p>You can monitor your cluster using Azure Monitor Insights.</p>
<p>Navigate to <a href="https://portal.azure.com">https://portal.azure.com</a> -&gt; your resource group -&gt; your kubernetes cluster</p>
<p>On an overview tab you fill find an information about your cluster (status, location, version, etc.). Also, here you will find a &ldquo;Monitor Containers&rdquo; link. Navigate to &ldquo;Monitor Containers&rdquo; and explore metrics and statuses of your Cluster, Nodes, Controllers and Containers.</p>
<p>Another option is to use the kubernetes dashboard. To do this, run:</p>
<pre><code class="language-sh">az aks browse --resource-group $AKS_RESOURCE_GROUP --name $AKS_CLUSTER_NAME
</code></pre>
<p>This will create a port forward for Kubernetes&rsquo; dashboard on your local port 8001.
Open <a href="http://127.0.0.1:8001">http://127.0.0.1:8001</a> in your browser and select <em>Namespace</em> <code>hono</code>, check status of your services, pods, etc.</p>
<h3 id="cleaning-up">Cleaning up</h3>
<p>Use the following command to delete all created resources (incl. the Kubernetes cluster and the private container registry)
once they are no longer needed:</p>
<pre><code class="language-sh">az group delete --name $AKS_RESOURCE_GROUP --yes --no-wait
</code></pre>
<h3 id="links">Links</h3>
<ul>
<li><a href="https://docs.microsoft.com/en-us/cli/azure/?view=azure-cli-latest">Azure CLI</a></li>
<li><a href="https://docs.microsoft.com/en-us/azure/aks/">Azure Kubernetes Service</a></li>
<li><a href="https://docs.microsoft.com/en-us/azure/container-registry/">Azure Container Registry</a></li>
</ul>
<footer class=" footline" >
</footer>
</div>
</div>
<div id="navigation">
</div>
</section>
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
</div>
<script src="/hono/docs/js/clipboard.min.js?1568942604"></script>
<script src="/hono/docs/js/perfect-scrollbar.min.js?1568942604"></script>
<script src="/hono/docs/js/perfect-scrollbar.jquery.min.js?1568942604"></script>
<script src="/hono/docs/js/jquery.sticky.js?1568942604"></script>
<script src="/hono/docs/js/featherlight.min.js?1568942604"></script>
<script src="/hono/docs/js/html5shiv-printshiv.min.js?1568942604"></script>
<script src="/hono/docs/js/highlight.pack.js?1568942604"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script src="/hono/docs/js/modernizr.custom.71422.js?1568942604"></script>
<script src="/hono/docs/js/learn.js?1568942604"></script>
<script src="/hono/docs/js/hugo-learn.js?1568942604"></script>
<link href="/hono/docs/mermaid/mermaid.css?1568942604" type="text/css" rel="stylesheet" />
<script src="/hono/docs/mermaid/mermaid.js?1568942604"></script>
<script>
mermaid.initialize({ startOnLoad: true });
</script>
<script>
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-5WLCZXC');
</script>
<script src="https://www.eclipse.org/eclipse.org-common/themes/solstice/public/javascript/vendor/cookieconsent/default.min.js"></script>
</body>
</html>