GithubHelp home page GithubHelp logo

simple-azure-cni-bash's Introduction

simple-azure-cni-bash

A simple bash based CNI works to allocate Azure VNET IP and assign to your POD

I got lots of idea from s-matyukevich

features:

  1. to dynamically creates a new ip-config for your Pod, without pre-assigned to VM (Azure VNET CNI is doing this way, but waste a lot of IPs) since IP-CONFIG will be created during CNI ADD , this will take much longger time for POD coming up. we can not run multiple CNI ADD at same time. so we have to lock and create ip-config one by one, this even slower when create multiple Pod at same node
  2. assign fixed IP when create new ip-config and assign static IP to a pod (by a annotation, just like calico does.)
  3. maybe other....

how to use:

  1. your Azure VM should enable Managed Identify and assign network contributor role to that this identity,

  2. make sure jq / kubelet / azure-cli are installed

    • jq:

      yum install -y epel-release
      yum install -y jq
    • azure-cli: azure-cli-installation

    • make sure /bin/jq, /bin/az, /bin/kubelet are present in you system and able to execute

  3. install this CNI

    • node-ip-alloc:

      wget -O /opt/cni/bin/node-ip-alloc \
         https://raw.githubusercontent.com/hydracz/simple-azure-cni-bash/main/node-ip-alloc
      chmod +x /opt/cni/bin/node-ip-alloc
    • conflist file: upload to /etc/cni/net.d

     wget -O /etc/cni/net.d/10-azure.conflist \
        https://raw.githubusercontent.com/hydracz/simple-azure-cni-bash/main/09-cni.conflist 
    
    • by Default kubeadm will save kubelet.conf in /etc/kubernetes/kubelet.conf, you need to modify the cni conflist in case your kubelet.conf is in different places
     {
       "cniVersion":"0.3.0",
       "name":"azure",
       "plugins":[
         {
           "type": "node-ip-alloc",
           "kubeletconf":"/etc/kubernetes/kubelet.conf"
         }
       ]
     }
    • prepare env file: upload to /etc/kubernetes/centos-k8s-cluster.env: currently 3 madatory ENV has to be present for this CNI to allocate ip-config and ips. different node will have different settings. I'm currently using a terraform per node template to generate this env..

      # cat /etc/kubernetes/centos-k8s-cluster.env
      export NODE_NIC_NAME="k8s-master-0-nic"
      export NODE_SUBNET_CIDR="10.0.0.0/17"
      export NODE_RG_NAME="rg-centos-k8s-southeastasia"
  4. to assign static ip to pod, you just need to annotate your pod with following:

    annotations:
      node-ip-alloc-ipv4-address: 10.0.0.0
      node-ip-alloc-method: static

simple-azure-cni-bash's People

Contributors

hydracz avatar

Watchers

 avatar

Forkers

nikawang

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.