1628 lines
56 KiB
HTML
1628 lines
56 KiB
HTML
|
|
|
|
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en" class="no-js">
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
|
|
|
|
|
|
|
|
|
<meta name="lang:clipboard.copy" content="Copy to clipboard">
|
|
|
|
<meta name="lang:clipboard.copied" content="Copied to clipboard">
|
|
|
|
<meta name="lang:search.language" content="en">
|
|
|
|
<meta name="lang:search.pipeline.stopwords" content="True">
|
|
|
|
<meta name="lang:search.pipeline.trimmer" content="True">
|
|
|
|
<meta name="lang:search.result.none" content="No matching documents">
|
|
|
|
<meta name="lang:search.result.one" content="1 matching document">
|
|
|
|
<meta name="lang:search.result.other" content="# matching documents">
|
|
|
|
<meta name="lang:search.tokenizer" content="[\s\-]+">
|
|
|
|
<link rel="shortcut icon" href="../../assets/images/favicon.png">
|
|
<meta name="generator" content="mkdocs-1.0.4, mkdocs-material-3.0.4">
|
|
|
|
|
|
|
|
<title>Bare-metal considerations - NGINX Ingress Controller</title>
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="../../assets/stylesheets/application.451f80e5.css">
|
|
|
|
<link rel="stylesheet" href="../../assets/stylesheets/application-palette.22915126.css">
|
|
|
|
|
|
|
|
|
|
<meta name="theme-color" content="#009688">
|
|
|
|
|
|
|
|
<script src="../../assets/javascripts/modernizr.1aa3b519.js"></script>
|
|
|
|
|
|
|
|
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
|
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono">
|
|
<style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
|
|
|
|
|
|
<link rel="stylesheet" href="../../assets/fonts/material-icons.css">
|
|
|
|
<link rel="stylesheet" href="../../extra.css">
|
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body dir="ltr" data-md-color-primary="teal" data-md-color-accent="green">
|
|
|
|
<svg class="md-svg">
|
|
<defs>
|
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448"
|
|
viewBox="0 0 416 448" id="__github">
|
|
<path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19-18.125
|
|
8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19 18.125-8.5
|
|
18.125 8.5 10.75 19 3.125 20.5zM320 304q0 10-3.125 20.5t-10.75
|
|
19-18.125 8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19
|
|
18.125-8.5 18.125 8.5 10.75 19 3.125 20.5zM360
|
|
304q0-30-17.25-51t-46.75-21q-10.25 0-48.75 5.25-17.75 2.75-39.25
|
|
2.75t-39.25-2.75q-38-5.25-48.75-5.25-29.5 0-46.75 21t-17.25 51q0 22 8
|
|
38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0
|
|
37.25-1.75t35-7.375 30.5-15 20.25-25.75 8-38.375zM416 260q0 51.75-15.25
|
|
82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5-41.75
|
|
1.125q-19.5 0-35.5-0.75t-36.875-3.125-38.125-7.5-34.25-12.875-30.25-20.25-21.5-28.75q-15.5-30.75-15.5-82.75
|
|
0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25
|
|
30.875q36.75-8.75 77.25-8.75 37 0 70 8 26.25-20.5
|
|
46.75-30.25t47.25-9.75q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34
|
|
99.5z" />
|
|
</svg>
|
|
|
|
</defs>
|
|
</svg>
|
|
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
|
|
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
|
|
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
|
|
|
|
<a href="../../#bare-metal-considerations" tabindex="1" class="md-skip">
|
|
Skip to content
|
|
</a>
|
|
|
|
|
|
<header class="md-header" data-md-component="header">
|
|
<nav class="md-header-nav md-grid">
|
|
<div class="md-flex">
|
|
<div class="md-flex__cell md-flex__cell--shrink">
|
|
<a href="../.." title="NGINX Ingress Controller" class="md-header-nav__button md-logo">
|
|
|
|
<i class="md-icon">public</i>
|
|
|
|
</a>
|
|
</div>
|
|
<div class="md-flex__cell md-flex__cell--shrink">
|
|
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
|
|
</div>
|
|
<div class="md-flex__cell md-flex__cell--stretch">
|
|
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
|
|
|
|
|
|
<span class="md-header-nav__topic">
|
|
NGINX Ingress Controller
|
|
</span>
|
|
<span class="md-header-nav__topic">
|
|
Bare-metal considerations
|
|
</span>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="md-flex__cell md-flex__cell--shrink">
|
|
|
|
|
|
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
|
|
|
|
<div class="md-search" data-md-component="search" role="dialog">
|
|
<label class="md-search__overlay" for="__search"></label>
|
|
<div class="md-search__inner" role="search">
|
|
<form class="md-search__form" name="search">
|
|
<input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
|
|
<label class="md-icon md-search__icon" for="__search"></label>
|
|
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
|
|

|
|
</button>
|
|
</form>
|
|
<div class="md-search__output">
|
|
<div class="md-search__scrollwrap" data-md-scrollfix>
|
|
<div class="md-search-result" data-md-component="result">
|
|
<div class="md-search-result__meta">
|
|
Type to start searching
|
|
</div>
|
|
<ol class="md-search-result__list"></ol>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="md-flex__cell md-flex__cell--shrink">
|
|
<div class="md-header-nav__source">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a href="https://github.com/kubernetes/ingress-nginx/" title="Go to repository" class="md-source" data-md-source="github">
|
|
|
|
<div class="md-source__icon">
|
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
|
<use xlink:href="#__github" width="24" height="24"></use>
|
|
</svg>
|
|
</div>
|
|
|
|
<div class="md-source__repository">
|
|
kubernetes/ingress-nginx
|
|
</div>
|
|
</a>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</nav>
|
|
</header>
|
|
|
|
<div class="md-container">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<nav class="md-tabs md-tabs--active" data-md-component="tabs">
|
|
<div class="md-tabs__inner md-grid">
|
|
<ul class="md-tabs__list">
|
|
|
|
|
|
|
|
|
|
<li class="md-tabs__item">
|
|
|
|
<a href="../.." title="Welcome" class="md-tabs__link">
|
|
Welcome
|
|
</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-tabs__item">
|
|
|
|
<a href="../" title="Deployment" class="md-tabs__link md-tabs__link--active">
|
|
Deployment
|
|
</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-tabs__item">
|
|
|
|
<a href="../../user-guide/nginx-configuration/" title="User guide" class="md-tabs__link">
|
|
User guide
|
|
</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-tabs__item">
|
|
|
|
<a href="../../examples/" title="Examples" class="md-tabs__link">
|
|
Examples
|
|
</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
</ul>
|
|
</div>
|
|
</nav>
|
|
|
|
<main class="md-main">
|
|
<div class="md-main__inner md-grid" data-md-component="container">
|
|
|
|
|
|
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
|
|
<div class="md-sidebar__scrollwrap">
|
|
<div class="md-sidebar__inner">
|
|
<nav class="md-nav md-nav--primary" data-md-level="0">
|
|
<label class="md-nav__title md-nav__title--site" for="__drawer">
|
|
<a href="../.." title="NGINX Ingress Controller" class="md-nav__button md-logo">
|
|
|
|
<i class="md-icon">public</i>
|
|
|
|
</a>
|
|
NGINX Ingress Controller
|
|
</label>
|
|
|
|
<div class="md-nav__source">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a href="https://github.com/kubernetes/ingress-nginx/" title="Go to repository" class="md-source" data-md-source="github">
|
|
|
|
<div class="md-source__icon">
|
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
|
<use xlink:href="#__github" width="24" height="24"></use>
|
|
</svg>
|
|
</div>
|
|
|
|
<div class="md-source__repository">
|
|
kubernetes/ingress-nginx
|
|
</div>
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<ul class="md-nav__list" data-md-scrollfix>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item md-nav__item--nested">
|
|
|
|
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-1" type="checkbox" id="nav-1">
|
|
|
|
<label class="md-nav__link" for="nav-1">
|
|
Welcome
|
|
</label>
|
|
<nav class="md-nav" data-md-component="collapsible" data-md-level="1">
|
|
<label class="md-nav__title" for="nav-1">
|
|
Welcome
|
|
</label>
|
|
<ul class="md-nav__list" data-md-scrollfix>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../.." title="Welcome" class="md-nav__link">
|
|
Welcome
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../how-it-works/" title="How it works" class="md-nav__link">
|
|
How it works
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../troubleshooting/" title="Troubleshooting" class="md-nav__link">
|
|
Troubleshooting
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../development/" title="Development" class="md-nav__link">
|
|
Development
|
|
</a>
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
</nav>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item md-nav__item--active md-nav__item--nested">
|
|
|
|
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-2" type="checkbox" id="nav-2" checked>
|
|
|
|
<label class="md-nav__link" for="nav-2">
|
|
Deployment
|
|
</label>
|
|
<nav class="md-nav" data-md-component="collapsible" data-md-level="1">
|
|
<label class="md-nav__title" for="nav-2">
|
|
Deployment
|
|
</label>
|
|
<ul class="md-nav__list" data-md-scrollfix>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../" title="Installation Guide" class="md-nav__link">
|
|
Installation Guide
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item md-nav__item--active">
|
|
|
|
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
|
|
|
|
|
|
|
|
|
|
<label class="md-nav__link md-nav__link--active" for="__toc">
|
|
Bare-metal considerations
|
|
</label>
|
|
|
|
<a href="./" title="Bare-metal considerations" class="md-nav__link md-nav__link--active">
|
|
Bare-metal considerations
|
|
</a>
|
|
|
|
|
|
<nav class="md-nav md-nav--secondary">
|
|
|
|
|
|
|
|
|
|
|
|
<label class="md-nav__title" for="__toc">Table of contents</label>
|
|
<ul class="md-nav__list" data-md-scrollfix>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#a-pure-software-solution-metallb" title="A pure software solution: MetalLB" class="md-nav__link">
|
|
A pure software solution: MetalLB
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#over-a-nodeport-service" title="Over a NodePort Service" class="md-nav__link">
|
|
Over a NodePort Service
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#via-the-host-network" title="Via the host network" class="md-nav__link">
|
|
Via the host network
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#using-a-self-provisioned-edge" title="Using a self-provisioned edge" class="md-nav__link">
|
|
Using a self-provisioned edge
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#external-ips" title="External IPs" class="md-nav__link">
|
|
External IPs
|
|
</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../rbac/" title="Role Based Access Control (RBAC)" class="md-nav__link">
|
|
Role Based Access Control (RBAC)
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../upgrade/" title="Upgrade" class="md-nav__link">
|
|
Upgrade
|
|
</a>
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
</nav>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item md-nav__item--nested">
|
|
|
|
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-3" type="checkbox" id="nav-3">
|
|
|
|
<label class="md-nav__link" for="nav-3">
|
|
User guide
|
|
</label>
|
|
<nav class="md-nav" data-md-component="collapsible" data-md-level="1">
|
|
<label class="md-nav__title" for="nav-3">
|
|
User guide
|
|
</label>
|
|
<ul class="md-nav__list" data-md-scrollfix>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item md-nav__item--nested">
|
|
|
|
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-3-1" type="checkbox" id="nav-3-1">
|
|
|
|
<label class="md-nav__link" for="nav-3-1">
|
|
NGINX Configuration
|
|
</label>
|
|
<nav class="md-nav" data-md-component="collapsible" data-md-level="2">
|
|
<label class="md-nav__title" for="nav-3-1">
|
|
NGINX Configuration
|
|
</label>
|
|
<ul class="md-nav__list" data-md-scrollfix>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../user-guide/nginx-configuration/" title="Introduction" class="md-nav__link">
|
|
Introduction
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../user-guide/nginx-configuration/annotations/" title="Annotations" class="md-nav__link">
|
|
Annotations
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../user-guide/nginx-configuration/configmap/" title="ConfigMap" class="md-nav__link">
|
|
ConfigMap
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../user-guide/nginx-configuration/custom-template/" title="Custom NGINX template" class="md-nav__link">
|
|
Custom NGINX template
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../user-guide/nginx-configuration/log-format/" title="Log format" class="md-nav__link">
|
|
Log format
|
|
</a>
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
</nav>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../user-guide/cli-arguments/" title="Command line arguments" class="md-nav__link">
|
|
Command line arguments
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../user-guide/custom-errors/" title="Custom errors" class="md-nav__link">
|
|
Custom errors
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../user-guide/default-backend/" title="Default backend" class="md-nav__link">
|
|
Default backend
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../user-guide/ingress-path-matching/" title="Regular expressions in paths" class="md-nav__link">
|
|
Regular expressions in paths
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../user-guide/external-articles/" title="External Articles" class="md-nav__link">
|
|
External Articles
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../user-guide/miscellaneous/" title="Miscellaneous" class="md-nav__link">
|
|
Miscellaneous
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../user-guide/monitoring/" title="Prometheus and Grafana installation" class="md-nav__link">
|
|
Prometheus and Grafana installation
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../user-guide/multiple-ingress/" title="Multiple Ingress controllers" class="md-nav__link">
|
|
Multiple Ingress controllers
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../user-guide/tls/" title="TLS/HTTPS" class="md-nav__link">
|
|
TLS/HTTPS
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item md-nav__item--nested">
|
|
|
|
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-3-11" type="checkbox" id="nav-3-11">
|
|
|
|
<label class="md-nav__link" for="nav-3-11">
|
|
Third party addons
|
|
</label>
|
|
<nav class="md-nav" data-md-component="collapsible" data-md-level="2">
|
|
<label class="md-nav__title" for="nav-3-11">
|
|
Third party addons
|
|
</label>
|
|
<ul class="md-nav__list" data-md-scrollfix>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../user-guide/third-party-addons/modsecurity/" title="ModSecurity Web Application Firewall" class="md-nav__link">
|
|
ModSecurity Web Application Firewall
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../user-guide/third-party-addons/opentracing/" title="OpenTracing" class="md-nav__link">
|
|
OpenTracing
|
|
</a>
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
</nav>
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
</nav>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item md-nav__item--nested">
|
|
|
|
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-4" type="checkbox" id="nav-4">
|
|
|
|
<label class="md-nav__link" for="nav-4">
|
|
Examples
|
|
</label>
|
|
<nav class="md-nav" data-md-component="collapsible" data-md-level="1">
|
|
<label class="md-nav__title" for="nav-4">
|
|
Examples
|
|
</label>
|
|
<ul class="md-nav__list" data-md-scrollfix>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../examples/" title="Introduction" class="md-nav__link">
|
|
Introduction
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../examples/PREREQUISITES/" title="Prerequisites" class="md-nav__link">
|
|
Prerequisites
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../examples/affinity/cookie/" title="Sticky Sessions" class="md-nav__link">
|
|
Sticky Sessions
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item md-nav__item--nested">
|
|
|
|
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-4-4" type="checkbox" id="nav-4-4">
|
|
|
|
<label class="md-nav__link" for="nav-4-4">
|
|
Auth
|
|
</label>
|
|
<nav class="md-nav" data-md-component="collapsible" data-md-level="2">
|
|
<label class="md-nav__title" for="nav-4-4">
|
|
Auth
|
|
</label>
|
|
<ul class="md-nav__list" data-md-scrollfix>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../examples/auth/basic/" title="Basic Authentication" class="md-nav__link">
|
|
Basic Authentication
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../examples/auth/client-certs/" title="Client Certificate Authentication" class="md-nav__link">
|
|
Client Certificate Authentication
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../examples/auth/external-auth/" title="External Basic Authentication" class="md-nav__link">
|
|
External Basic Authentication
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../examples/auth/oauth-external-auth/" title="External OAUTH Authentication" class="md-nav__link">
|
|
External OAUTH Authentication
|
|
</a>
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
</nav>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item md-nav__item--nested">
|
|
|
|
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-4-5" type="checkbox" id="nav-4-5">
|
|
|
|
<label class="md-nav__link" for="nav-4-5">
|
|
Customization
|
|
</label>
|
|
<nav class="md-nav" data-md-component="collapsible" data-md-level="2">
|
|
<label class="md-nav__title" for="nav-4-5">
|
|
Customization
|
|
</label>
|
|
<ul class="md-nav__list" data-md-scrollfix>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../examples/customization/configuration-snippets/" title="Configuration Snippets" class="md-nav__link">
|
|
Configuration Snippets
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../examples/customization/custom-configuration/" title="Custom Configuration" class="md-nav__link">
|
|
Custom Configuration
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../examples/customization/custom-errors/" title="Custom Errors" class="md-nav__link">
|
|
Custom Errors
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../examples/customization/custom-headers/" title="Custom Headers" class="md-nav__link">
|
|
Custom Headers
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../examples/customization/external-auth-headers/" title="External authentication" class="md-nav__link">
|
|
External authentication
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../examples/customization/ssl-dh-param/" title="Custom DH parameters for perfect forward secrecy" class="md-nav__link">
|
|
Custom DH parameters for perfect forward secrecy
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../examples/customization/sysctl/" title="Sysctl tuning" class="md-nav__link">
|
|
Sysctl tuning
|
|
</a>
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
</nav>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../examples/docker-registry/" title="Docker registry" class="md-nav__link">
|
|
Docker registry
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../examples/grpc/" title="gRPC" class="md-nav__link">
|
|
gRPC
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../examples/multi-tls/" title="Multi TLS certificate termination" class="md-nav__link">
|
|
Multi TLS certificate termination
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../examples/rewrite/" title="Rewrite" class="md-nav__link">
|
|
Rewrite
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../examples/static-ip/" title="Static IPs" class="md-nav__link">
|
|
Static IPs
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../examples/tls-termination/" title="TLS termination" class="md-nav__link">
|
|
TLS termination
|
|
</a>
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
</nav>
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
|
|
<div class="md-sidebar__scrollwrap">
|
|
<div class="md-sidebar__inner">
|
|
|
|
<nav class="md-nav md-nav--secondary">
|
|
|
|
|
|
|
|
|
|
|
|
<label class="md-nav__title" for="__toc">Table of contents</label>
|
|
<ul class="md-nav__list" data-md-scrollfix>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#a-pure-software-solution-metallb" title="A pure software solution: MetalLB" class="md-nav__link">
|
|
A pure software solution: MetalLB
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#over-a-nodeport-service" title="Over a NodePort Service" class="md-nav__link">
|
|
Over a NodePort Service
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#via-the-host-network" title="Via the host network" class="md-nav__link">
|
|
Via the host network
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#using-a-self-provisioned-edge" title="Using a self-provisioned edge" class="md-nav__link">
|
|
Using a self-provisioned edge
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#external-ips" title="External IPs" class="md-nav__link">
|
|
External IPs
|
|
</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="md-content">
|
|
<article class="md-content__inner md-typeset">
|
|
|
|
|
|
<a href="https://github.com/kubernetes/ingress-nginx/edit/master/docs/deploy/baremetal.md" title="Edit this page" class="md-icon md-content__icon"></a>
|
|
|
|
|
|
<h1 id="bare-metal-considerations">Bare-metal considerations<a class="headerlink" href="#bare-metal-considerations" title="Permanent link">¶</a></h1>
|
|
<p>In traditional <em>cloud</em> environments, where network load balancers are available on-demand, a single Kubernetes manifest
|
|
suffices to provide a single point of contact to the NGINX Ingress controller to external clients and, indirectly, to
|
|
any application running inside the cluster. <em>Bare-metal</em> environments lack this commodity, requiring a slightly
|
|
different setup to offer the same kind of access to external consumers.</p>
|
|
<p><img alt="Cloud environment" src="../../images/baremetal/cloud_overview.jpg" />
|
|
<img alt="Bare-metal environment" src="../../images/baremetal/baremetal_overview.jpg" /></p>
|
|
<p>The rest of this document describes a few recommended approaches to deploying the NGINX Ingress controller inside a
|
|
Kubernetes cluster running on bare-metal.</p>
|
|
<h2 id="a-pure-software-solution-metallb">A pure software solution: MetalLB<a class="headerlink" href="#a-pure-software-solution-metallb" title="Permanent link">¶</a></h2>
|
|
<p><a href="https://metallb.universe.tf/">MetalLB</a> provides a network load-balancer implementation for Kubernetes clusters that do not run on a
|
|
supported cloud provider, effectively allowing the usage of LoadBalancer Services within any cluster.</p>
|
|
<p>This section demonstrates how to use the <a href="https://metallb.universe.tf/tutorial/layer2/">Layer 2 configuration mode</a> of MetalLB together with the NGINX
|
|
Ingress controller in a Kubernetes cluster that has <strong>publicly accessible nodes</strong>. In this mode, one node attracts all
|
|
the traffic for the <code class="codehilite">ingress-nginx</code> Service IP. See <a href="https://metallb.universe.tf/usage/#traffic-policies">Traffic policies</a> for more details.</p>
|
|
<p><img alt="MetalLB in L2 mode" src="../../images/baremetal/metallb.jpg" /></p>
|
|
<div class="admonition note">
|
|
<p class="admonition-title">Note</p>
|
|
<p>The description of other supported configuration modes is off-scope for this document.</p>
|
|
</div>
|
|
<div class="admonition warning">
|
|
<p class="admonition-title">Warning</p>
|
|
<p>MetalLB is currently in <em>beta</em>. Read about the <a href="https://metallb.universe.tf/concepts/maturity/">Project maturity</a> and make sure you inform
|
|
yourself by reading the official documentation thoroughly.</p>
|
|
</div>
|
|
<p>MetalLB can be deployed either with a simple Kubernetes manifest or with Helm. The rest of this example assumes MetalLB
|
|
was deployed following the <a href="https://metallb.universe.tf/installation/">Installation</a> instructions.</p>
|
|
<p>MetalLB requires a pool of IP addresses in order to be able to take ownership of the <code class="codehilite">ingress-nginx</code> Service. This pool
|
|
can be defined in a ConfigMap named <code class="codehilite">config</code> located in the same namespace as the MetalLB controller. In the simplest
|
|
possible scenario, the pool is composed of the IP addresses of Kubernetes nodes, but IP addresses can also be handed out
|
|
by a DHCP server.</p>
|
|
<div class="admonition example">
|
|
<p class="admonition-title">Example</p>
|
|
<p>Given the following 3-node Kubernetes cluster (the external IP is added as an example, in most bare-metal
|
|
environments this value is <None>)</p>
|
|
<div class="codehilite"><pre><span></span><span class="gp">$</span> kubectl describe node
|
|
<span class="go">NAME STATUS ROLES EXTERNAL-IP</span>
|
|
<span class="go">host-1 Ready master 203.0.113.1</span>
|
|
<span class="go">host-2 Ready node 203.0.113.2</span>
|
|
<span class="go">host-3 Ready node 203.0.113.3</span>
|
|
</pre></div>
|
|
|
|
<p>After creating the following ConfigMap, MetalLB takes ownership of one of the IP addresses in the pool and updates
|
|
the <em>loadBalancer</em> IP field of the <code class="codehilite">ingress-nginx</code> Service accordingly.</p>
|
|
<div class="codehilite"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">apiVersion</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">v1</span>
|
|
<span class="l l-Scalar l-Scalar-Plain">kind</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">ConfigMap</span>
|
|
<span class="l l-Scalar l-Scalar-Plain">metadata</span><span class="p p-Indicator">:</span>
|
|
<span class="l l-Scalar l-Scalar-Plain">namespace</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">metallb-system</span>
|
|
<span class="l l-Scalar l-Scalar-Plain">name</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">config</span>
|
|
<span class="l l-Scalar l-Scalar-Plain">data</span><span class="p p-Indicator">:</span>
|
|
<span class="l l-Scalar l-Scalar-Plain">config</span><span class="p p-Indicator">:</span> <span class="p p-Indicator">|</span>
|
|
<span class="no">address-pools:</span>
|
|
<span class="no">- name: default</span>
|
|
<span class="no">protocol: layer2</span>
|
|
<span class="no">addresses:</span>
|
|
<span class="no">- 203.0.113.2-203.0.113.3</span>
|
|
</pre></div>
|
|
|
|
<div class="codehilite"><pre><span></span><span class="gp">$</span> kubectl -n ingress-nginx get svc
|
|
<span class="go">NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)</span>
|
|
<span class="go">default-http-backend ClusterIP 10.0.64.249 <none> 80/TCP</span>
|
|
<span class="go">ingress-nginx LoadBalancer 10.0.220.217 203.0.113.3 80:30100/TCP,443:30101/TCP</span>
|
|
</pre></div>
|
|
|
|
</div>
|
|
<p>As soon as MetalLB sets the external IP address of the <code class="codehilite">ingress-nginx</code> LoadBalancer Service, the corresponding entries
|
|
are created in the iptables NAT table and the node with the selected IP address starts responding to HTTP requests on
|
|
the ports configured in the LoadBalancer Service:</p>
|
|
<div class="codehilite"><pre><span></span><span class="gp">$</span> curl -D- http://203.0.113.3 -H <span class="s1">'Host: myapp.example.com'</span>
|
|
<span class="go">HTTP/1.1 200 OK</span>
|
|
<span class="go">Server: nginx/1.15.2</span>
|
|
</pre></div>
|
|
|
|
<div class="admonition tip">
|
|
<p class="admonition-title">Tip</p>
|
|
<p>In order to preserve the source IP address in HTTP requests sent to NGINX, it is necessary to use the <code class="codehilite">Local</code>
|
|
traffic policy. Traffic policies are described in more details in <a href="https://metallb.universe.tf/usage/#traffic-policies">Traffic policies</a> as
|
|
well as in the next section.</p>
|
|
</div>
|
|
<h2 id="over-a-nodeport-service">Over a NodePort Service<a class="headerlink" href="#over-a-nodeport-service" title="Permanent link">¶</a></h2>
|
|
<p>Due to its simplicity, this is the setup a user will deploy by default when following the steps described in the
|
|
<a href="./deploy/#baremetal">installation guide</a>.</p>
|
|
<div class="admonition info">
|
|
<p class="admonition-title">Info</p>
|
|
<p>A Service of type <code class="codehilite">NodePort</code> exposes, via the <code class="codehilite">kube-proxy</code> component, the <strong>same unprivileged</strong> port (default:
|
|
30000-32767) on every Kubernetes node, masters included. For more information, see <a href="https://kubernetes.io/docs/concepts/services-networking/service/#nodeport">Services</a>.</p>
|
|
</div>
|
|
<p>In this configuration, the NGINX container remains isolated from the host network. As a result, it can safely bind to
|
|
any port, including the standard HTTP ports 80 and 443. However, due to the container namespace isolation, a client
|
|
located outside the cluster network (e.g. on the public internet) is not able to access Ingress hosts directly on ports
|
|
80 and 443. Instead, the external client must append the NodePort allocated to the <code class="codehilite">ingress-nginx</code> Service to HTTP
|
|
requests.</p>
|
|
<p><img alt="NodePort request flow" src="../../images/baremetal/nodeport.jpg" /></p>
|
|
<div class="admonition example">
|
|
<p class="admonition-title">Example</p>
|
|
<p>Given the NodePort <code class="codehilite">30100</code> allocated to the <code class="codehilite">ingress-nginx</code> Service</p>
|
|
<div class="codehilite"><pre><span></span><span class="gp">$</span> kubectl -n ingress-nginx get svc
|
|
<span class="go">NAME TYPE CLUSTER-IP PORT(S)</span>
|
|
<span class="go">default-http-backend ClusterIP 10.0.64.249 80/TCP</span>
|
|
<span class="go">ingress-nginx NodePort 10.0.220.217 80:30100/TCP,443:30101/TCP</span>
|
|
</pre></div>
|
|
|
|
<p>and a Kubernetes node with the public IP address <code class="codehilite">203.0.113.2</code> (the external IP is added as an example, in most
|
|
bare-metal environments this value is <None>)</p>
|
|
<div class="codehilite"><pre><span></span><span class="gp">$</span> kubectl describe node
|
|
<span class="go">NAME STATUS ROLES EXTERNAL-IP</span>
|
|
<span class="go">host-1 Ready master 203.0.113.1</span>
|
|
<span class="go">host-2 Ready node 203.0.113.2</span>
|
|
<span class="go">host-3 Ready node 203.0.113.3</span>
|
|
</pre></div>
|
|
|
|
<p>a client would reach an Ingress with <code class="codehilite"><span class="n">host</span><span class="o">:</span> <span class="n">myapp</span><span class="o">.</span><span class="na">example</span><span class="o">.</span><span class="na">com</span></code> at <code class="codehilite">http://myapp.example.com:30100</code>, where the
|
|
myapp.example.com subdomain resolves to the 203.0.113.2 IP address.</p>
|
|
</div>
|
|
<div class="admonition danger">
|
|
<p class="admonition-title">Impact on the host system</p>
|
|
<p>While it may sound tempting to reconfigure the NodePort range using the <code class="codehilite">--service-node-port-range</code> API server flag
|
|
to include unprivileged ports and be able to expose ports 80 and 443, doing so may result in unexpected issues
|
|
including (but not limited to) the use of ports otherwise reserved to system daemons and the necessity to grant
|
|
<code class="codehilite">kube-proxy</code> privileges it may otherwise not require.</p>
|
|
<p>This practice is therefore <strong>discouraged</strong>. See the other approaches proposed in this page for alternatives.</p>
|
|
</div>
|
|
<p>This approach has a few other limitations one ought to be aware of:</p>
|
|
<ul>
|
|
<li><strong>Source IP address</strong></li>
|
|
</ul>
|
|
<p>Services of type NodePort perform <a href="https://kubernetes.io/docs/tutorials/services/source-ip/#source-ip-for-services-with-type-nodeport">source address translation</a> by default. This means the source IP of a
|
|
HTTP request is always <strong>the IP address of the Kubernetes node that received the request</strong> from the perspective of
|
|
NGINX.</p>
|
|
<p>The recommended way to preserve the source IP in a NodePort setup is to set the value of the <code class="codehilite">externalTrafficPolicy</code>
|
|
field of the <code class="codehilite">ingress-nginx</code> Service spec to <code class="codehilite">Local</code> (<a href="https://github.com/kubernetes/ingress-nginx/blob/nginx-0.19.0/deploy/provider/aws/service-nlb.yaml#L12-L14">example</a>).</p>
|
|
<div class="admonition warning">
|
|
<p class="admonition-title">Warning</p>
|
|
<p>This setting effectively <strong>drops packets</strong> sent to Kubernetes nodes which are not running any instance of the NGINX
|
|
Ingress controller. Consider <a href="https://kubernetes.io/docs/concepts/configuration/assign-pod-node/">assigning NGINX Pods to specific nodes</a> in order to control on what nodes
|
|
the NGINX Ingress controller should be scheduled or not scheduled.</p>
|
|
</div>
|
|
<div class="admonition example">
|
|
<p class="admonition-title">Example</p>
|
|
<p>In a Kubernetes cluster composed of 3 nodes (the external IP is added as an example, in most bare-metal environments
|
|
this value is <None>)</p>
|
|
<div class="codehilite"><pre><span></span><span class="gp">$</span> kubectl describe node
|
|
<span class="go">NAME STATUS ROLES EXTERNAL-IP</span>
|
|
<span class="go">host-1 Ready master 203.0.113.1</span>
|
|
<span class="go">host-2 Ready node 203.0.113.2</span>
|
|
<span class="go">host-3 Ready node 203.0.113.3</span>
|
|
</pre></div>
|
|
|
|
<p>with a <code class="codehilite">nginx-ingress-controller</code> Deployment composed of 2 replicas</p>
|
|
<div class="codehilite"><pre><span></span><span class="gp">$</span> kubectl -n ingress-nginx get pod -o wide
|
|
<span class="go">NAME READY STATUS IP NODE</span>
|
|
<span class="go">default-http-backend-7c5bc89cc9-p86md 1/1 Running 172.17.1.1 host-2</span>
|
|
<span class="go">nginx-ingress-controller-cf9ff8c96-8vvf8 1/1 Running 172.17.0.3 host-3</span>
|
|
<span class="go">nginx-ingress-controller-cf9ff8c96-pxsds 1/1 Running 172.17.1.4 host-2</span>
|
|
</pre></div>
|
|
|
|
<p>Requests sent to <code class="codehilite">host-2</code> and <code class="codehilite">host-3</code> would be forwarded to NGINX and original client's IP would be preserved,
|
|
while requests to <code class="codehilite">host-1</code> would get dropped because there is no NGINX replica running on that node.</p>
|
|
</div>
|
|
<ul>
|
|
<li><strong>Ingress status</strong></li>
|
|
</ul>
|
|
<p>Because NodePort Services do not get a LoadBalancerIP assigned by definition, the NGINX Ingress controller <strong>does not
|
|
update the status of Ingress objects it manages</strong>.</p>
|
|
<div class="codehilite"><pre><span></span><span class="gp">$</span> kubectl get ingress
|
|
<span class="go">NAME HOSTS ADDRESS PORTS</span>
|
|
<span class="go">test-ingress myapp.example.com 80</span>
|
|
</pre></div>
|
|
|
|
<p>Despite the fact there is no load balancer providing a public IP address to the NGINX Ingress controller, it is possible
|
|
to force the status update of all managed Ingress objects by setting the <code class="codehilite">externalIPs</code> field of the <code class="codehilite">ingress-nginx</code>
|
|
Service.</p>
|
|
<div class="admonition warning">
|
|
<p class="admonition-title">Warning</p>
|
|
<p>There is more to setting <code class="codehilite">externalIPs</code> than just enabling the NGINX Ingress controller to update the status of
|
|
Ingress objects. Please read about this option in the <a href="https://kubernetes.io/docs/concepts/services-networking/service/#external-ips">Services</a> page of official Kubernetes
|
|
documentation as well as the section about <a href="#external-ips">External IPs</a> in this document for more information.</p>
|
|
</div>
|
|
<div class="admonition example">
|
|
<p class="admonition-title">Example</p>
|
|
<p>Given the following 3-node Kubernetes cluster (the external IP is added as an example, in most bare-metal
|
|
environments this value is <None>)</p>
|
|
<div class="codehilite"><pre><span></span><span class="gp">$</span> kubectl describe node
|
|
<span class="go">NAME STATUS ROLES EXTERNAL-IP</span>
|
|
<span class="go">host-1 Ready master 203.0.113.1</span>
|
|
<span class="go">host-2 Ready node 203.0.113.2</span>
|
|
<span class="go">host-3 Ready node 203.0.113.3</span>
|
|
</pre></div>
|
|
|
|
<p>one could edit the <code class="codehilite">ingress-nginx</code> Service and add the following field to the object spec</p>
|
|
<div class="codehilite"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">spec</span><span class="p p-Indicator">:</span>
|
|
<span class="l l-Scalar l-Scalar-Plain">externalIPs</span><span class="p p-Indicator">:</span>
|
|
<span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">203.0.113.1</span>
|
|
<span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">203.0.113.2</span>
|
|
<span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">203.0.113.3</span>
|
|
</pre></div>
|
|
|
|
<p>which would in turn be reflected on Ingress objects as follows:</p>
|
|
<div class="codehilite"><pre><span></span><span class="gp">$</span> kubectl get ingress -o wide
|
|
<span class="go">NAME HOSTS ADDRESS PORTS</span>
|
|
<span class="go">test-ingress myapp.example.com 203.0.113.1,203.0.113.2,203.0.113.3 80</span>
|
|
</pre></div>
|
|
|
|
</div>
|
|
<ul>
|
|
<li><strong>Redirects</strong></li>
|
|
</ul>
|
|
<p>As NGINX is <strong>not aware of the port translation operated by the NodePort Service</strong>, backend applications are responsible
|
|
for generating redirect URLs that take into account the URL used by external clients, including the NodePort.</p>
|
|
<div class="admonition example">
|
|
<p class="admonition-title">Example</p>
|
|
<p>Redirects generated by NGINX, for instance HTTP to HTTPS or <code class="codehilite">domain</code> to <code class="codehilite">www.domain</code>, are generated without
|
|
NodePort:</p>
|
|
<div class="codehilite"><pre><span></span><span class="gp">$</span> curl -D- http://myapp.example.com:30100<span class="sb">`</span>
|
|
<span class="go">HTTP/1.1 308 Permanent Redirect</span>
|
|
<span class="go">Server: nginx/1.15.2</span>
|
|
<span class="go">Location: https://myapp.example.com/ #-> missing NodePort in HTTPS redirect</span>
|
|
</pre></div>
|
|
|
|
</div>
|
|
<h2 id="via-the-host-network">Via the host network<a class="headerlink" href="#via-the-host-network" title="Permanent link">¶</a></h2>
|
|
<p>In a setup where there is no external load balancer available but using NodePorts is not an option, one can configure
|
|
<code class="codehilite">ingress-nginx</code> Pods to use the network of the host they run on instead of a dedicated network namespace. The benefit of
|
|
this approach is that the NGINX Ingress controller can bind ports 80 and 443 directly to Kubernetes nodes' network
|
|
interfaces, without the extra network translation imposed by NodePort Services.</p>
|
|
<div class="admonition note">
|
|
<p class="admonition-title">Note</p>
|
|
<p>This approach does not leverage any Service object to expose the NGINX Ingress controller. If the <code class="codehilite">ingress-nginx</code>
|
|
Service exists in the target cluster, it is <strong>recommended to delete it</strong>.</p>
|
|
</div>
|
|
<p>This can be achieved by enabling the <code class="codehilite">hostNetwork</code> option in the Pods' spec.</p>
|
|
<div class="codehilite"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">template</span><span class="p p-Indicator">:</span>
|
|
<span class="l l-Scalar l-Scalar-Plain">spec</span><span class="p p-Indicator">:</span>
|
|
<span class="l l-Scalar l-Scalar-Plain">hostNetwork</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">true</span>
|
|
</pre></div>
|
|
|
|
<div class="admonition danger">
|
|
<p class="admonition-title">Security considerations</p>
|
|
<p>Enabling this option <strong>exposes every system daemon to the NGINX Ingress controller</strong> on any network interface,
|
|
including the host's loopback. Please evaluate the impact this may have on the security of your system carefully.</p>
|
|
</div>
|
|
<div class="admonition example">
|
|
<p class="admonition-title">Example</p>
|
|
<p>Consider this <code class="codehilite">nginx-ingress-controller</code> Deployment composed of 2 replicas, NGINX Pods inherit from the IP address
|
|
of their host instead of an internal Pod IP.</p>
|
|
<div class="codehilite"><pre><span></span><span class="gp">$</span> kubectl -n ingress-nginx get pod -o wide
|
|
<span class="go">NAME READY STATUS IP NODE</span>
|
|
<span class="go">default-http-backend-7c5bc89cc9-p86md 1/1 Running 172.17.1.1 host-2</span>
|
|
<span class="go">nginx-ingress-controller-5b4cf5fc6-7lg6c 1/1 Running 203.0.113.3 host-3</span>
|
|
<span class="go">nginx-ingress-controller-5b4cf5fc6-lzrls 1/1 Running 203.0.113.2 host-2</span>
|
|
</pre></div>
|
|
|
|
</div>
|
|
<p>One major limitation of this deployment approach is that only <strong>a single NGINX Ingress controller Pod</strong> may be scheduled
|
|
on each cluster node, because binding the same port multiple times on the same network interface is technically
|
|
impossible. Pods that are unschedulable due to such situation fail with the following event:</p>
|
|
<div class="codehilite"><pre><span></span><span class="gp">$</span> kubectl -n ingress-nginx describe pod <unschedulable-nginx-ingress-controller-pod>
|
|
<span class="go">...</span>
|
|
<span class="go">Events:</span>
|
|
<span class="go"> Type Reason From Message</span>
|
|
<span class="go"> ---- ------ ---- -------</span>
|
|
<span class="go"> Warning FailedScheduling default-scheduler 0/3 nodes are available: 3 node(s) didn't have free ports for the requested pod ports.</span>
|
|
</pre></div>
|
|
|
|
<p>One way to ensure only schedulable Pods are created is to deploy the NGINX Ingress controller as a <em>DaemonSet</em> instead
|
|
of a traditional Deployment.</p>
|
|
<div class="admonition info">
|
|
<p class="admonition-title">Info</p>
|
|
<p>A DaemonSet schedules exactly one type of Pod per cluster node, masters included, unless a node is configured to
|
|
<a href="https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/">repel those Pods</a>. For more information, see <a href="https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/">DaemonSet</a>.</p>
|
|
</div>
|
|
<p>Because most properties of DaemonSet objects are identical to Deployment objects, this documentation page leaves the
|
|
configuration of the corresponding manifest at the user's discretion.</p>
|
|
<p><img alt="DaemonSet with hostNetwork flow" src="../../images/baremetal/hostnetwork.jpg" /></p>
|
|
<p>Like with NodePorts, this approach has a few quirks it is important to be aware of.</p>
|
|
<ul>
|
|
<li><strong>DNS resolution</strong></li>
|
|
</ul>
|
|
<p>Pods configured with <code class="codehilite"><span class="n">hostNetwork</span><span class="o">:</span> <span class="kc">true</span></code> do not use the internal DNS resolver (i.e. <em>kube-dns</em> or <em>CoreDNS</em>), unless
|
|
their <code class="codehilite">dnsPolicy</code> spec field is set to <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy"><code class="codehilite">ClusterFirstWithHostNet</code></a>. Consider using this setting if NGINX is
|
|
expected to resolve internal names for any reason.</p>
|
|
<ul>
|
|
<li><strong>Ingress status</strong></li>
|
|
</ul>
|
|
<p>Because there is no Service exposing the NGINX Ingress controller in a configuration using the host network, the default
|
|
<code class="codehilite">--publish-service</code> flag used in standard cloud setups <strong>does not apply</strong> and the status of all Ingress objects remains
|
|
blank.</p>
|
|
<div class="codehilite"><pre><span></span><span class="gp">$</span> kubectl get ingress
|
|
<span class="go">NAME HOSTS ADDRESS PORTS</span>
|
|
<span class="go">test-ingress myapp.example.com 80</span>
|
|
</pre></div>
|
|
|
|
<p>Instead, and because bare-metal nodes usually don't have an ExternalIP, one has to enable the
|
|
<a href="../../user-guide/cli-arguments/"><code class="codehilite">--report-node-internal-ip-address</code></a> flag, which sets the status of all Ingress objects to the internal IP
|
|
address of all nodes running the NGINX Ingress controller.</p>
|
|
<div class="admonition example">
|
|
<p class="admonition-title">Example</p>
|
|
<p>Given a <code class="codehilite">nginx-ingress-controller</code> DaemonSet composed of 2 replicas</p>
|
|
<div class="codehilite"><pre><span></span><span class="gp">$</span> kubectl -n ingress-nginx get pod -o wide
|
|
<span class="go">NAME READY STATUS IP NODE</span>
|
|
<span class="go">default-http-backend-7c5bc89cc9-p86md 1/1 Running 172.17.1.1 host-2</span>
|
|
<span class="go">nginx-ingress-controller-5b4cf5fc6-7lg6c 1/1 Running 203.0.113.3 host-3</span>
|
|
<span class="go">nginx-ingress-controller-5b4cf5fc6-lzrls 1/1 Running 203.0.113.2 host-2</span>
|
|
</pre></div>
|
|
|
|
<p>the controller sets the status of all Ingress objects it manages to the following value:</p>
|
|
<div class="codehilite"><pre><span></span><span class="gp">$</span> kubectl get ingress -o wide
|
|
<span class="go">NAME HOSTS ADDRESS PORTS</span>
|
|
<span class="go">test-ingress myapp.example.com 203.0.113.2,203.0.113.3 80</span>
|
|
</pre></div>
|
|
|
|
</div>
|
|
<div class="admonition note">
|
|
<p class="admonition-title">Note</p>
|
|
<p>Alternatively, it is possible to override the address written to Ingress objects using the
|
|
<code class="codehilite">--publish-status-address</code> flag. See <a href="../../user-guide/cli-arguments/">Command line arguments</a>.</p>
|
|
</div>
|
|
<h2 id="using-a-self-provisioned-edge">Using a self-provisioned edge<a class="headerlink" href="#using-a-self-provisioned-edge" title="Permanent link">¶</a></h2>
|
|
<p>Similarly to cloud environments, this deployment approach requires an edge network component providing a public
|
|
entrypoint to the Kubernetes cluster. This edge component can be either hardware (e.g. vendor appliance) or software
|
|
(e.g. <em>HAproxy</em>) and is usually managed outside of the Kubernetes landscape by operations teams.</p>
|
|
<p>Such deployment builds upon the NodePort Service described above in <a href="#over-a-nodeport-service">Over a NodePort Service</a>,
|
|
with one significant difference: external clients do not access cluster nodes directly, only the edge component does.
|
|
This is particularly suitable for private Kubernetes clusters where none of the nodes has a public IP address.</p>
|
|
<p>On the edge side, the only prerequisite is to dedicate a public IP address that forwards all HTTP traffic to Kubernetes
|
|
nodes and/or masters. Incoming traffic on TCP ports 80 and 443 is forwarded to the corresponding HTTP and HTTPS NodePort
|
|
on the target nodes as shown in the diagram below:</p>
|
|
<p><img alt="User edge" src="../../images/baremetal/user_edge.jpg" /></p>
|
|
<h2 id="external-ips">External IPs<a class="headerlink" href="#external-ips" title="Permanent link">¶</a></h2>
|
|
<div class="admonition danger">
|
|
<p class="admonition-title">Source IP address</p>
|
|
<p>This method does not allow preserving the source IP of HTTP requests in any manner, it is therefore <strong>not
|
|
recommended</strong> to use it despite its apparent simplicity.</p>
|
|
</div>
|
|
<p>The <code class="codehilite">externalIPs</code> Service option was previously mentioned in the <a href="#over-a-nodeport-service">NodePort</a> section.</p>
|
|
<p>As per the <a href="https://kubernetes.io/docs/concepts/services-networking/service/#external-ips">Services</a> page of the official Kubernetes documentation, the <code class="codehilite">externalIPs</code> option causes
|
|
<code class="codehilite">kube-proxy</code> to route traffic sent to arbitrary IP addresses <strong>and on the Service ports</strong> to the endpoints of that
|
|
Service. These IP addresses <strong>must belong to the target node</strong>.</p>
|
|
<div class="admonition example">
|
|
<p class="admonition-title">Example</p>
|
|
<p>Given the following 3-node Kubernetes cluster (the external IP is added as an example, in most bare-metal
|
|
environments this value is <None>)</p>
|
|
<div class="codehilite"><pre><span></span><span class="gp">$</span> kubectl describe node
|
|
<span class="go">NAME STATUS ROLES EXTERNAL-IP</span>
|
|
<span class="go">host-1 Ready master 203.0.113.1</span>
|
|
<span class="go">host-2 Ready node 203.0.113.2</span>
|
|
<span class="go">host-3 Ready node 203.0.113.3</span>
|
|
</pre></div>
|
|
|
|
<p>and the following <code class="codehilite">ingress-nginx</code> NodePort Service</p>
|
|
<div class="codehilite"><pre><span></span><span class="gp">$</span> kubectl -n ingress-nginx get svc
|
|
<span class="go">NAME TYPE CLUSTER-IP PORT(S)</span>
|
|
<span class="go">ingress-nginx NodePort 10.0.220.217 80:30100/TCP,443:30101/TCP</span>
|
|
</pre></div>
|
|
|
|
<p>One could set the following external IPs in the Service spec, and NGINX would become available on both the NodePort
|
|
and the Service port:</p>
|
|
<div class="codehilite"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">spec</span><span class="p p-Indicator">:</span>
|
|
<span class="l l-Scalar l-Scalar-Plain">externalIPs</span><span class="p p-Indicator">:</span>
|
|
<span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">203.0.113.2</span>
|
|
<span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">203.0.113.3</span>
|
|
</pre></div>
|
|
|
|
<div class="codehilite"><pre><span></span><span class="gp">$</span> curl -D- http://myapp.example.com:30100
|
|
<span class="go">HTTP/1.1 200 OK</span>
|
|
<span class="go">Server: nginx/1.15.2</span>
|
|
|
|
<span class="gp">$</span> curl -D- http://myapp.example.com
|
|
<span class="go">HTTP/1.1 200 OK</span>
|
|
<span class="go">Server: nginx/1.15.2</span>
|
|
</pre></div>
|
|
|
|
<p>We assume the myapp.example.com subdomain above resolves to both 203.0.113.2 and 203.0.113.3 IP addresses.</p>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</article>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
|
|
<footer class="md-footer">
|
|
|
|
<div class="md-footer-nav">
|
|
<nav class="md-footer-nav__inner md-grid">
|
|
|
|
<a href="../" title="Installation Guide" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
|
|
<div class="md-flex__cell md-flex__cell--shrink">
|
|
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
|
|
</div>
|
|
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
|
<span class="md-flex__ellipsis">
|
|
<span class="md-footer-nav__direction">
|
|
Previous
|
|
</span>
|
|
Installation Guide
|
|
</span>
|
|
</div>
|
|
</a>
|
|
|
|
|
|
<a href="../rbac/" title="Role Based Access Control (RBAC)" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
|
|
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
|
<span class="md-flex__ellipsis">
|
|
<span class="md-footer-nav__direction">
|
|
Next
|
|
</span>
|
|
Role Based Access Control (RBAC)
|
|
</span>
|
|
</div>
|
|
<div class="md-flex__cell md-flex__cell--shrink">
|
|
<i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
|
|
</div>
|
|
</a>
|
|
|
|
</nav>
|
|
</div>
|
|
|
|
<div class="md-footer-meta md-typeset">
|
|
<div class="md-footer-meta__inner md-grid">
|
|
<div class="md-footer-copyright">
|
|
|
|
powered by
|
|
<a href="https://www.mkdocs.org">MkDocs</a>
|
|
and
|
|
<a href="https://squidfunk.github.io/mkdocs-material/">
|
|
Material for MkDocs</a>
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
|
|
</div>
|
|
|
|
<script src="../../assets/javascripts/application.583bbe55.js"></script>
|
|
|
|
<script>app.initialize({version:"1.0.4",url:{base:"../.."}})</script>
|
|
|
|
|
|
|
|
|
|
<script>!function(e,a,t,n,o,c,i){e.GoogleAnalyticsObject=o,e.ga=e.ga||function(){(e.ga.q=e.ga.q||[]).push(arguments)},e.ga.l=1*new Date,c=a.createElement(t),i=a.getElementsByTagName(t)[0],c.async=1,c.src="https://www.google-analytics.com/analytics.js",i.parentNode.insertBefore(c,i)}(window,document,"script",0,"ga"),ga("create","UA-118407822-1","kubernetes.github.io"),ga("set","anonymizeIp",!0),ga("send","pageview");var links=document.getElementsByTagName("a");if(Array.prototype.map.call(links,function(e){e.host!=document.location.host&&e.addEventListener("click",function(){var a=e.getAttribute("data-md-action")||"follow";ga("send","event","outbound",a,e.href)})}),document.forms.search){var query=document.forms.search.query;query.addEventListener("blur",function(){if(this.value){var e=document.location.pathname;ga("send","pageview",e+"?q="+this.value)}})}</script>
|
|
|
|
|
|
</body>
|
|
</html> |