Jump to: navigation, search

Difference between revisions of "StarlingX/Features Around Kubernetes"

(Created page with "== Additional Functionalities around STX Kubernetes cluster == === MetalLB as Network Load balancer with NGINX-Ingress controller === To undestand about MetalLB Network load...")
 
(Changes to enable metalLB with Ingress controller)
 
(One intermediate revision by the same user not shown)
Line 14: Line 14:
 
==== Changes to enable metalLB with Ingress controller====
 
==== Changes to enable metalLB with Ingress controller====
 
Modify the Nginx ingress controller of Kube-system namespace as loadbalancer type.
 
Modify the Nginx ingress controller of Kube-system namespace as loadbalancer type.
 +
 
'''
 
'''
 +
$kubectl edit svc ingress -n kube-system
 +
 
spec:
 
spec:
 
     type: LoadBalancer
 
     type: LoadBalancer
Line 37: Line 40:
 
           servicePort: 80
 
           servicePort: 80
 
  '''
 
  '''
 +
 +
For eg. Pods with Hello world NGINX application nginx-dep.yaml:
 +
'''
 +
apiVersion: apps/v1
 +
kind: Deployment
 +
metadata:
 +
  name: my-nginx
 +
  namespace: nginx-test
 +
spec:
 +
  selector:
 +
    matchLabels:
 +
      run: my-nginx
 +
  replicas: 2
 +
  template:
 +
    metadata:
 +
      labels:
 +
        run: my-nginx
 +
    spec:
 +
      containers:
 +
      - name: my-nginx
 +
        image: nginx
 +
        ports:
 +
        - containerPort: 80
 +
---
 +
apiVersion: v1
 +
kind: Service
 +
metadata:
 +
  name: my-nginx
 +
  namespace: nginx-test
 +
  labels:
 +
    run: my-nginx
 +
spec:
 +
  ports:
 +
  - port: 80
 +
    protocol: TCP
 +
  selector:
 +
    run: my-nginx
 +
 +
'''
 +
 +
  
 
===== Debugging =====
 
===== Debugging =====

Latest revision as of 16:14, 10 July 2020

Additional Functionalities around STX Kubernetes cluster

MetalLB as Network Load balancer with NGINX-Ingress controller

To undestand about MetalLB Network load balancer for Bare metal and NGINX-Ingress controller for service routing, please visit Baremetal LB for NGINX Ingress page to know more about it.

Installing MetalLB Load Balancer

Install MetalLB load balancers as specified in the MetalLB Installation Page. We are considering here the Layer 2 configuration setting of MetalLB as it is simplest and doesnot bout to the network interfaces of the node.It works by responding to ARP requests on your local network directly, to give the machine’s MAC address to clients. Create configmap with IP range of your local NW. If you want to have a separate data network for the MetalLB/Ingress controller than the OAM IP subnet, you can assign that data NW subnet IP address range in configmap and connect one of the NIC to that data subnet. As MetalLB is configured on Layer 2 mode,MetalLB automatically listens/advertises on all interfaces.

Ingress controller in StarlingX

There are two NGINX Ingress controller on STX of which the ingress.class are named differently as “nginx” within openstack namespace and “nginx-cluster” within kube-system namespace.

Changes to enable metalLB with Ingress controller

Modify the Nginx ingress controller of Kube-system namespace as loadbalancer type.

$kubectl edit svc ingress -n kube-system

spec:

   type: LoadBalancer

Create ingress resource with your application and ingress.class as "nginx-cluster" in the annotation as below:

 apiVersion: networking.k8s.io/v1beta1

kind: Ingress metadata:

 name: my-ingress-res
 namespace: nginx-test
 annotations:
   kubernetes.io/ingress.class: "nginx-cluster"

spec:

 rules:
 - host: my-nginx-lb.example.com
   http:
     paths:
     - backend:
         serviceName: my-nginx
         servicePort: 80

For eg. Pods with Hello world NGINX application nginx-dep.yaml: apiVersion: apps/v1 kind: Deployment metadata:

 name: my-nginx
 namespace: nginx-test

spec:

 selector:
   matchLabels:
     run: my-nginx
 replicas: 2
 template:
   metadata:
     labels:
       run: my-nginx
   spec:
     containers:
     - name: my-nginx
       image: nginx
       ports:
       - containerPort: 80

--- apiVersion: v1 kind: Service metadata:

 name: my-nginx
 namespace: nginx-test
 labels:
   run: my-nginx

spec:

 ports:
 - port: 80
   protocol: TCP
 selector:
   run: my-nginx


Debugging

Do the arping to the Ingress controller service to check if it is replying the arp reqest

 $ arping -I ens3 192.168.1.240

Can do T=tcpdump as well

$ tcpdump -n -i ens3 arp src host 192.168.1.240