Puppet Class: k8s::node::simple_cni

Defined in:
manifests/node/simple_cni.pp

Summary

Provide a simple bridged standard network interface. For basic usage if one does not have flannel, cilium, calico or something else yet. Uses the cni-plugins bridge binary to create a bridge interface to connect the containers

Overview

Class: k8s::node::simple_cni

Parameters:

  • pod_cidr (K8s::CIDR) (defaults to: $k8s::cluster_cidr)

    cidr for pods in the network



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'manifests/node/simple_cni.pp', line 8

class k8s::node::simple_cni (
  K8s::CIDR $pod_cidr = $k8s::cluster_cidr,
) {
  $bridge = {
    cniVersion => '0.4.0',
    name => 'bridge',
    type => 'bridge',
    bridge => 'cnio0',
    isGateway => true,
    ipMasq => true,
    ipam => {
      type => 'host-local',
      ranges => [[{ subnet => $pod_cidr }]],
      routes => [{ dst => '0.0.0.0/0' }],
    },
  }

  $loopback = {
    cniVersion => '0.4.0',
    name => 'lo',
    type => 'loopback',
  }

  file { '/etc/cni/net.d/10-bridge.conf':
    ensure  => file,
    content => $bridge.to_json,
    require => File['/etc/cni/net.d'],
  }

  file { '/etc/cni/net.d/99-loopback.conf':
    ensure  => file,
    content => $loopback.to_json,
    require => File['/etc/cni/net.d'],
  }
}