Enable Platform9 DHCP

Platform9 DHCP is the recommended DHCP (vs whereabouts ) for KubeVirt installations. When leveraging whereabouts there is an issue that occurs during Live Migrations where the Virtual Machine IP address will change when migrated to the target host.

What is Platform9 DHCP

Platform9 created an alternative to whereabouts for the KubeVirt use case by having a DHCP server running inside the pod/vm to cater to the DHCP requests from the virtual machine instance (not the pod in the case of Kubevirt). Multus Network Attachment Definition will use the DHCP server, and there is no need to specify the IPAM plugin. The client/consumer VM will need the dhclient for sending DHCP requests.

Prerequisites

  • Kubevirt
  • Advanced Networking Operator (Luigi)
  • Kubemacpool

Enabling the Platform9 DHCP Addon:

  1. Using the Advanced Networking Operator (Luigi) add-on, enable dhcpController addon by creating a Network Plugin resource as shown:
YAML
Copy
  1. This creates the dhcp-controller-system namespace with the controller for the dnsmasq. This also installs Kubemacpool in dhcp-controller-system namespace.
  2. Create HostNetoworkTemplate & NetworkAttachmentDefinition .
YAML
Copy
YAML
Copy
  1. NetworkAttachmentDefinition used with Platform9 IPAM omits the ipam section in the config, which is present when whereabouts is used as IPAM. Platform9 IPAM also supports OVS-DPDK networks.
  2. Create a DHCP Server
YAML
Copy
  1. About the fields

a . Name: Name of the DHCPServer. Configurations of dnsmasq will be generated in a Configmap with the same name

b. networks: list of all networks that this pod will serve

  • networkName: Name of NetworkAttachmentDefinition. Should not have dhcp plugin enabled.
  • interfaceIp: IP address that the pod will be allocated. Must have prefix to ensure proper routes are added.
  • leaseDuration: Duration the leases offered should be valid for. Provide in valid formats for dnsmasq (eg: 10m, 5h, etc). Defaults to 1h
  • vlanId: Dnsmasq network identifier. Used as an identifier while restoring IPs.
  • cidr:range_start, range_end, gateway are optional. range is compulsory. If range start and end are provided, they will be used in place of the default start and end.
  1. A configmap is generated based on the DHCPServer. This is a conf file for dnsmasq. It can be overridden by creating a valid configmap with the same name as that of the DHCPServer.

For any specific configurations, you can provide your own configmap. Create a configmap with valid dnsmasq.conf parameters. Along with this, dhcp-range must be in one of these two formats

  1. dhcp-range=<start_IP>,<end_ip>,<netmask>,<leasetime>
  2. dhcp-range=<vlanID>,<start_ip>,<end_ip>,<netmask>,<leasetime>
  1. Sample VM yaml to apply
YAML
Copy
  1. Sample StatefulSet YAML to apply.
YAML
Copy
  1. An IPAllocation is made for every lease stored in the server. It is used to restore leases back to the DHCPServer. Leases are only restored to the vlanID mentioned. Lease will expire at leaseExpiry. Sample of how an IPAllocation looks
YAML
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard
  Last updated