Share
Embed
Transcript
18 slides
-
Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis
non erat sem Two ways to route the traffic … VPC-Native Cluster Route-Based Cluster It is a cluster that uses alias IP address ranges route traffic from one Pod to another Pod. It is a cluster that uses custom static routes in a VPC network. -
Proprietary + Confidential Thanks for the context! But could you
tell please How to calculate the IPs? Proprietary + Confidential -
Definitions Kubernetes Pods When you created a Deployment, Kubernetes created
a Pod to host your application instance. A Pod is a abstraction that represents a group of one or more application containers (such as Docker), and some shared resources for those containers. Kubernetes Nodes A Pod always runs on a Node. A Node is a worker machine in Kubernetes and may be either a virtual or a physical machine. Each Node is managed by the control plane, which handles scheduling the pods across the Nodes. Kubernetes Services A Service in Kubernetes is an abstraction which defines a logical set of Pods and a policy by which to access them. Services enable a loose coupling between dependent Pods. A Service is defined using YAML or JSON. -
For each we must to assign: The Pod IP addresses
which are taken from the secondary IP address range of the cluster. Unless you set a different number of pods per node, GKE allocates a /24 alias IP range. The Node IP addresses which are taken from the primary IP address range of the subnet associated with your cluster. The Service IP addresses which are taken from other secondary IP address range of the cluster. -
Proprietary + Confidential If you notice before we need …
Proprietary + Confidential -
Start by answering three questions … How many … 1.
Maximum number of nodes? 2. Maximum number of pods per node will to be used? 3. Maximum number of services will to be used? -
Calculate the Subnet Primary IP Range For the Nodes Following
these formulas: If you have the maximum number of nodes N calculate the size of the netmask S whose valid range is between 8 and 29, inclusive. S = 32 - ⌈log2(N + 4)⌉ ⌈⌉ is the ceiling (least integer) function If you have the size of the netmask S calculate the maximum number of nodes N, whose valid range is between 8 and 29, inclusive. N = 2 - 4 (32 -S) -
Example 1. Maximum number of nodes? 12 2. Maximum number
of pods per node? 110 [default] 3. Maximum number of services will to be used? 5000 -
Example Nodes Subnet CIDR: /28 — for 12 nodes S
= 32 - ⌈log2(N + 4)⌉ S = 32 - ⌈log2(12 + 4)⌉ S = 32 - 4 = 28 1. Pods CIDR: /21 — for 2048 IP addresses M = 31 - ⌈log2(12 * 110)⌉ M = 31 - 10 = 21 2. Services CIDR: /20 — for 4096 IP addresses In this case, /20 CIDR has 4096 addresses is the minimum needed for the (3000 IP Addresses) services CIDR. -
Calculate the range and assign the Subnet Primary IP Range
Subnet Primary IP range Maximum nodes /29 Min size 4 nodes /28 12 nodes /27 28 nodes /26 60 nodes /25 124 nodes /24 252 nodes Subnet primary IP range Maximum nodes /23 508 nodes /22 1,020 nodes /21 2,044 nodes /20 Default size 4,092 nodes /19 8,188 nodes /8 Max size 16,777,212 nodes For the Nodes -
Calculate the size of the netmask of each node's Pod
range, M: M = 31 - ⌈log2(Q)⌉ where: Q is the number of Pods per node ⌈⌉ is the ceiling function Calculate the maximum number of nodes, N: N = 2(M - S) where: M is the size of the netmask of each node S is the size of the subnet mask of the subnet's secondary IP address Calculate the maximum number of Pods, P: P = N × Q where: N is the maximum number of nodes, calculated in the previous step Q is the number of Pods per node Calculate the Subnet Secondary IP Range For the Pods -
Example Nodes Subnet CIDR: /28 — for 12 nodes S
= 32 - ⌈log2(N + 4)⌉ S = 32 - ⌈log2(12 + 4)⌉ S = 32 - 4 = 28 Pods CIDR: /20 — for 1760 IP addresses M = 31 - ⌈log2(N * 110)⌉ M = 31 - ⌈log2(12 * 110)⌉ M = 31 - 11 = 20 1. Services CIDR: /20 — for 4096 IP addresses In this case, /20 CIDR has 4096 addresses is the minimum needed for the (3000 IP Addresses) services CIDR. -
Calculate the range and assign the Subnet Secondary IP Range
Subnet Secondary IP range for Pods Maximum Pod IP addresses Maximum nodes Maximum Pods /24 smallest possible Pod IP range 256 addresses 1 node 110 Pods /23 possible when it is user-managed 512 addresses 2 nodes 220 Pods /22 possible when it is user-managed 1,024 addresses 4 nodes 440 Pods /21 possible when it is managed by GKE 2,048 addresses 8 nodes 880 Pods /20 4,096 addresses 16 nodes 1,760 Pods /19 8,192 addresses 32 nodes 3,520 Pods /18 16,384 addresses 64 nodes 7,040 Pods /17 32,768 addresses 128 nodes 14,080 Pods For the Pods -
Subnet secondary IP range for Pods Maximum Pod IP addresses
Maximum nodes Maximum Pods /16 65,536 addresses 256 nodes 28,160 Pods /15 131,072 addresses 512 nodes 56,320 Pods /14 default size when is managed by GKE 262,144 addresses 1,024 nodes 112,640 Pods /13 524,288 addresses 2,048 nodes 225,280 Pods /12 1,048,576 addresses 4,096 nodes 450,560 Pods /11 2,097,152 addresses 8,192 nodes 901,120 Pods /10 4,194,304 addresses 16,384 nodes 1,802,240 Pods /9 Largest possible Pod address range 8,388,608 addresses 32,768 nodes 3,604,480 Pods For the Pods Calculate the range and assign the Subnet Secondary IP Range -
Calculate the range and assign the Subnet Secondary IP Range
For the Pods Secondary IP range for Services Maximum number of Services /28 Smallest possible 16 Services /27 Smallest possible 32 Services /26 64 Services /25 128 Services /24 256 Services /23 512 Services /22 1,024 Services Secondary IP range for Services Maximum number of Services /21 2,048 Services /20 Default size 4,096 Services /19 8,192 Services /18 16,384 Services /17 32,768 Services /16 Largest possible 65,536 Services -
Example Nodes Subnet CIDR: /28 — for 12 nodes S
= 32 - ⌈log2(N + 4)⌉ S = 32 - ⌈log2(12 + 4)⌉ S = 32 - 4 = 28 Pods CIDR: /20 — for 1760 IP addresses M = 31 - ⌈log2(N * 110)⌉ M = 31 - ⌈log2(12 * 110)⌉ M = 31 - 11 = 20 Services CIDR: /19 — for 8190 IP addresses In this case, /19 CIDR has 8190 addresses is the minimum needed for the (5000 IP Addresses) services CIDR.