Tanzu Community Edition

Documentation

Whereabouts Package

This package provides the ability to assign IP addresses dynamically across your Kubernetes cluster using a CNI IPAM plugin named whereabouts.

Components

  • Whereabouts Custom Resources
  • Whereabouts DaemonSet
  • Whereabouts ServiceAccount
  • Whereabouts ClusterRoleBinding
  • Whereabouts ip-reconciler Cronjob

Configuration

The following configuration values can be set to customize the whereabouts installation.

Global

ValueRequired/OptionalDescription
namespaceOptionalThe namespace in which to deploy whereabouts components. Default: kube-system

whereabouts Configuration

ValueRequired/OptionalDescription
whereabouts.config.resources.limits.cpuOptionalThe limits for CPU resources of whereabouts DeamonSet
whereabouts.config.resources.limits.memoryOptionalThe limits for memory resources of whereabouts DeamonSet
whereabouts.config.resources.requests.cpuOptionalThe requests for CPU resources of whereabouts DeamonSet
whereabouts.config.resources.requests.memoryOptionalThe requests for memory resources of whereabouts DeamonSet
ip_reconciler.config.scheduleOptionalThe schedule of ip-reconciler CronJob. Default: */5 * * * *
ip_reconciler.config.resources.requests.cpuOptionalThe requests for memory resources of ip-reconciler CronJob
ip_reconciler.config.resources.requests.memoryOptionalThe requests for memory resources of ip-reconciler CronJob

Usage

The follow is a basic guide for getting started with whereabouts.

This example guides you about attaching the second network interface to a pod with IP address assigned in the range you specified using whereabouts.

  1. Install TCE Multus CNI package to support multiple network by following doc:

  2. Install TCE whereabouts package through Tanzu CLI

    tanzu package install whereabouts --package-name whereabouts.community.tanzu.vmware.com --version ${WHEREABOUTS_PACKAGE_VERSION}
    

    You can get the ${WHEREABOUTS_PACKAGE_VERSION} from running tanzu package available list whereabouts.community.tanzu.vmware.com. Specifying a namespace may be required depending on where your package repository was installed.

  3. After the Multus CNI and whereabouts DaemonSet are running, you can define your NetworkAttachmentDefinition to tell

    • which CNI plugin will be used for the second network interface, in particular this example uses ipvlan CNI plugin
    • what IP addressed will be assigned for the second network interface, in particular this example uses whereabouts CNI IPAM plugin
    cat <<EOF | kubectl create -f -
     apiVersion: "k8s.cni.cncf.io/v1"
     kind: NetworkAttachmentDefinition
     metadata:
     name: ipvlan-conf-1
     spec:
     config: '{
         "cniVersion": "0.3.0",
         "name": "ipvlan-conf-1",
         "type": "ipvlan",
         "master": "eth0",
         "mode": "bridge",
         "ipam": {
             "type": "whereabouts",
             "range": "192.168.20.0/24",
             "gateway": "192.168.20.1",
             "range_start": "192.168.20.2",
             "range_end": "192.168.20.100"
         }
         }'
     EOF
    
  4. Deploy a pod using the NetworkAttachmentDefinition named ipvlan-conf-1 as above by adding following lines to the pod metadata.annotations:

    metadata:
      annotations:
        k8s.v1.cni.cncf.io/networks: ipvlan-conf-1
    
  5. After the pod is running, run following command to describe your pod and there will be an event for adding the second network interface within IP range we specified with whereabouts.

    kubectl describe {your-pod}
    ... ...
    Events:
     Type    Reason          Age   From               Message
     ----    ------          ----  ----               -------
     Normal  AddedInterface  2m1s  multus             Add eth0 [100.96.1.6/24]
     Normal  AddedInterface  2m1s  multus             Add net1 [192.168.20.10/24] from default/ipvlan-conf-1
    

    You can also run following command to check more details about the second network interface:

    kubectl exec {your-pod} -- ip a
    

Join us!

Our open community welcomes all users and contributors

Community