1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. Copyright 2020, Samsung Electronics
6 .. _HELM Best Practices Guide: https://docs.helm.sh/chart_best_practices/#requirements
7 .. _kubectl Cheat Sheet: https://kubernetes.io/docs/reference/kubectl/cheatsheet/
8 .. _Kubernetes documentation for emptyDir: https://kubernetes.io/docs/concepts/storage/volumes/#emptydir
9 .. _metallb Metal Load Balancer installation: https://metallb.universe.tf/installation/
10 .. _http://cd.onap.info:30223/mso/logging/debug: http://cd.onap.info:30223/mso/logging/debug
11 .. _Onboarding and Distributing a Vendor Software Product: https://wiki.onap.org/pages/viewpage.action?pageId=1018474
12 .. _README.md: https://gerrit.onap.org/r/gitweb?p=oom.git;a=blob;f=kubernetes/README.md
14 .. figure:: oomLogoV2-medium.png
17 .. _onap-on-kubernetes-with-rancher:
20 Ingress controller setup on HA Kubernetes Cluster
21 #################################################
23 This guide provides instruction how to setup experimental ingress controller feature.
24 For this, we are hosting our cluster on OpenStack VMs and using the Rancher Kubernetes Engine (RKE)
25 to deploy and manage our Kubernetes Cluster and ingress controller
32 The result at the end of this tutorial will be:
34 #. Customization of the cluster.yaml file for ingress controller support
36 #. Installation and configuration test DNS server for ingress host resolution on testing machines
38 #. Instalation and configuration MLB (Metal Load Balancer) required for exposing ingress service
40 #. Instalation and configuration NGINX ingress controller
42 #. Additional info howto deploy onap with services exposed via Ingress controller
44 Customize cluster.yml file
45 ===========================
46 Before setup cluster for ingress purposes DNS cluster IP and ingress provider should be configured and follwing:
58 - <custer_dns_ip>:31555
60 Where the <cluster_dns_ip> should be set to the same IP as the CONTROLPANE node.
62 For external load balacer purposes minimum one of the worker node should be configured with external IP
63 address accessible outside the cluster. It can be done using the following example node configuration:
67 - address: <external_ip>
68 internal_address: <internal_ip>
72 hostname_override: "onap-worker-0"
74 ssh_key_path: "~/.ssh/id_rsa"
77 Where the <external_ip> is external worker node IP address, and <internal_ip> is internal node IP address if it is required
81 DNS server configuration and instalation
82 ========================
83 DNS server deployed on the Kubernetes cluster makes it easy to use services exposed through ingress controller because it
84 resolves all subdomain related to the onap cluster to the load balancer IP.
85 Testing ONAP cluster requires a lot of entries on the target machines in the /etc/hosts.
86 Adding many entries into the configuration files on testing machines is quite problematic and error prone.
87 The better wait is to create central DNS server with entries for all virtual host pointed to simpledemo.onap.org and add custom DNS server as a target DNS server for testing machines and/or as external DNS for kubernetes cluster.
89 DNS server has automatic instalation and configuration script, so instalation is quite easy::
91 > cd kubernetes/contrib/dns-server-for-vhost-ingress-testing
95 After DNS deploy you need to setup DNS entry on the target testing machine.
96 Because DNS listen on non standard port configuration require iptables rules
97 on the target machine. Please follow the configuation proposed by the deploy scripts
98 Example output depends on the IP address and example output looks like bellow::
101 DNS server already deployed:
102 1. You can add the DNS server to the target machine using following commands:
103 sudo iptables -t nat -A OUTPUT -p tcp -d 192.168.211.211 --dport 53 -j DNAT --to-destination 10.10.13.14:31555
104 sudo iptables -t nat -A OUTPUT -p udp -d 192.168.211.211 --dport 53 -j DNAT --to-destination 10.10.13.14:31555
105 sudo sysctl -w net.ipv4.conf.all.route_localnet=1
106 sudo sysctl -w net.ipv4.ip_forward=1
107 2. Update /etc/resolv.conf file with nameserver 192.168.211.211 entry on your target machine
110 MetalLB Load Balancer instalation and configuration
111 ====================================================
113 By default pure Kubernetes cluster requires external load balancer if we want to expose
114 external port using LoadBalancer settings. For this purpose MetalLB can be used.
115 Before installing the MetalLB you need to ensure that at least one worker has assigned IP acessible outside the cluster.
117 MetalLB Load balanancer can be easily installed using automatic install script::
119 > cd kubernetes/contrib/metallb-loadbalancer-inst
121 > ./install-metallb-on-cluster.sh
124 Configuration NGINX ingress controller
125 =======================================
127 After installation DNS server and ingress controller we can install and configure ingress controller.
128 It can be done using the following commands::
130 > cd kubernetes/contrib/ingress-nginx-post-inst
132 > kubectl apply -f nginx_ingress_cluster_config.yaml
134 > kubectl apply -f nginx_ingress_enable_optional_load_balacer_service.yaml
136 After deploy NGINX ingress controller you can ensure that the ingress port is exposed as load balancer service
137 with external IP address::
139 > kubectl get svc -n ingress-nginx
140 NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
141 default-http-backend ClusterIP 10.10.10.10 <none> 80/TCP 25h
142 ingress-nginx LoadBalancer 10.10.10.11 10.12.13.14 80:31308/TCP,443:30314/TCP 24h
145 ONAP with ingress exposed services
146 =====================================
147 If you want to deploy onap with services exposed through ingress controller you can use full onap deploy script::
148 > onap/resources/overrides/onap-all-ingress-nginx-vhost.yaml
150 Ingress also can be enabled on any onap setup override using following code:
154 #ingress virtualhost based configuration