Skip to content

Commit 6100acd

Browse files
authored
Merge pull request #89994 from mlearned/mlearned-aks-calico
Mlearned aks calico
2 parents b6f2bb9 + d4fd0e7 commit 6100acd

File tree

3 files changed

+30
-14
lines changed

3 files changed

+30
-14
lines changed

articles/aks/concepts-network.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ This article introduces the core concepts that provide networking to your applic
2525

2626
To allow access to your applications, or for application components to communicate with each other, Kubernetes provides an abstraction layer to virtual networking. Kubernetes nodes are connected to a virtual network, and can provide inbound and outbound connectivity for pods. The *kube-proxy* component runs on each node to provide these network features.
2727

28-
In Kubernetes, *Services* logically group pods to allow for direct access via an IP address or DNS name and on a specific port. You can also distribute traffic using a *load balancer*. More complex routing of application traffic can also be achieved with *Ingress Controllers*. Security and filtering of the network traffic for pods is possible with Kubernetes *network policies* (in preview in AKS).
28+
In Kubernetes, *Services* logically group pods to allow for direct access via an IP address or DNS name and on a specific port. You can also distribute traffic using a *load balancer*. More complex routing of application traffic can also be achieved with *Ingress Controllers*. Security and filtering of the network traffic for pods is possible with Kubernetes *network policies*.
2929

3030
The Azure platform also helps to simplify virtual networking for AKS clusters. When you create a Kubernetes load balancer, the underlying Azure load balancer resource is created and configured. As you open network ports to pods, the corresponding Azure network security group rules are configured. For HTTP application routing, Azure can also configure *external DNS* as new ingress routes are configured.
3131

articles/aks/configure-kubenet.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ With *kubenet*, only the nodes receive an IP address in the virtual network subn
3434

3535
![Kubenet network model with an AKS cluster](media/use-kubenet/kubenet-overview.png)
3636

37-
Azure supports a maximum of 400 routes in a UDR, so you can't have an AKS cluster larger than 400 nodes. AKS features such as [Virtual Nodes][virtual-nodes] or network policies aren't supported with *kubenet*.
37+
Azure supports a maximum of 400 routes in a UDR, so you can't have an AKS cluster larger than 400 nodes. AKS [Virtual Nodes][virtual-nodes] and Azure Network Policies aren't supported with *kubenet*. You can use [Calico Network Policies][calico-network-policies], as they are supported with kubenet.
3838

39-
With *Azure CNI*, each pod receives an IP address in the IP subnet, and can directly communicate with other pods and services. Your clusters can be as large as the IP address range you specify. However, the IP address range must be planned in advance, and all of the IP addresses are consumed by the AKS nodes based on the maximum number of pods that they can support. Advanced network features and scenarios such as [Virtual Nodes][virtual-nodes] or network policies are supported with *Azure CNI*.
39+
With *Azure CNI*, each pod receives an IP address in the IP subnet, and can directly communicate with other pods and services. Your clusters can be as large as the IP address range you specify. However, the IP address range must be planned in advance, and all of the IP addresses are consumed by the AKS nodes based on the maximum number of pods that they can support. Advanced network features and scenarios such as [Virtual Nodes][virtual-nodes] or Network Policies (either Azure or Calico) are supported with *Azure CNI*.
4040

4141
### IP address availability and exhaustion
4242

@@ -68,20 +68,17 @@ Use *kubenet* when:
6868

6969
- You have limited IP address space.
7070
- Most of the pod communication is within the cluster.
71-
- You don't need advanced features such as virtual nodes or network policy.
71+
- You don't need advanced AKS features such as virtual nodes or Azure Network Policy. Use [Calico network policies][calico-network-policies].
7272

7373
Use *Azure CNI* when:
7474

7575
- You have available IP address space.
7676
- Most of the pod communication is to resources outside of the cluster.
7777
- You don’t want to manage the UDRs.
78-
- You need advanced features such as virtual nodes or network policy.
78+
- You need AKS advanced features such as virtual nodes or Azure Network Policy. Use [Calico network policies][calico-network-policies].
7979

8080
For more information to help you decide which network model to use, see [Compare network models and their support scope][network-comparisons].
8181

82-
> [!NOTE]
83-
> Kuberouter makes it possible to enable network policy when using kubenet and can be installed as a daemonset in an AKS cluster. Please be aware kube-router is still in beta and no support is offered by Microsoft for the project.
84-
8582
## Create a virtual network and subnet
8683

8784
To get started with using *kubenet* and your own virtual network subnet, first create a resource group using the [az group create][az-group-create] command. The following example creates a resource group named *myResourceGroup* in the *eastus* location:
@@ -168,6 +165,24 @@ az aks create \
168165
--client-secret <password>
169166
```
170167

168+
> [!Note]
169+
> If you wish to enable an AKS cluster to include a [Calico network policy][calico-network-policies] you can use the following command.
170+
171+
```azurecli-interactive
172+
az aks create \
173+
--resource-group myResourceGroup \
174+
--name myAKSCluster \
175+
--node-count 3 \
176+
--network-plugin kubenet --network-policy calico \
177+
--service-cidr 10.0.0.0/16 \
178+
--dns-service-ip 10.0.0.10 \
179+
--pod-cidr 10.244.0.0/16 \
180+
--docker-bridge-address 172.17.0.1/16 \
181+
--vnet-subnet-id $SUBNET_ID \
182+
--service-principal <appId> \
183+
--client-secret <password>
184+
```
185+
171186
When you create an AKS cluster, a network security group and route table are created. These network resources are managed by the AKS control plane. The network security group is automatically associated with the virtual NICs on your nodes. The route table is automatically associated with the virtual network subnet. Network security group rules and route tables and are automatically updated as you create and expose services.
172187

173188
## Next steps
@@ -178,6 +193,7 @@ With an AKS cluster deployed into your existing virtual network subnet, you can
178193
[dev-spaces]: https://docs.microsoft.com/azure/dev-spaces/
179194
[cni-networking]: https://github.com/Azure/azure-container-networking/blob/master/docs/cni.md
180195
[kubenet]: https://kubernetes.io/docs/concepts/cluster-administration/network-plugins/#kubenet
196+
[Calico-network-policies]: https://docs.projectcalico.org/v3.9/security/calico-network-policy
181197

182198
<!-- LINKS - Internal -->
183199
[install-azure-cli]: /cli/azure/install-azure-cli

articles/aks/use-network-policies.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Azure provides two ways to implement network policy. You choose a network policy
4646

4747
Both implementations use Linux *IPTables* to enforce the specified policies. Policies are translated into sets of allowed and disallowed IP pairs. These pairs are then programmed as IPTable filter rules.
4848

49-
Network policy only works with the Azure CNI (advanced) option. Implementation is different for the two options:
49+
Implementation is different for the two options:
5050

5151
* *Azure Network Policies* - the Azure CNI sets up a bridge in the VM host for intra-node networking. The filtering rules are applied when the packets pass through the bridge.
5252
* *Calico Network Policies* - the Azure CNI sets up local kernel routes for the intra-node traffic. The policies are applied on the pod’s network interface.
@@ -56,7 +56,7 @@ Network policy only works with the Azure CNI (advanced) option. Implementation i
5656
| Capability | Azure | Calico |
5757
|------------------------------------------|----------------------------|-----------------------------|
5858
| Supported platforms | Linux | Linux |
59-
| Supported networking options | Azure CNI | Azure CNI |
59+
| Supported networking options | Azure CNI | Azure CNI and kubenet |
6060
| Compliance with Kubernetes specification | All policy types supported | All policy types supported |
6161
| Additional features | None | Extended policy model consisting of Global Network Policy, Global Network Set, and Host Endpoint. For more information on using the `calicoctl` CLI to manage these extended features, see [calicoctl user reference][calicoctl]. |
6262
| Support | Supported by Azure support and Engineering team | Calico community support. For more information on additional paid support, see [Project Calico support options][calico-support]. |
@@ -72,15 +72,15 @@ To see network policies in action, let's create and then expand on a policy that
7272

7373
First, let's create an AKS cluster that supports network policy. The network policy feature can only be enabled when the cluster is created. You can't enable network policy on an existing AKS cluster.
7474

75-
To use network policy with an AKS cluster, you must use the [Azure CNI plug-in][azure-cni] and define your own virtual network and subnets. For more detailed information on how to plan out the required subnet ranges, see [configure advanced networking][use-advanced-networking].
75+
To use Azure Network Policy, you must use the [Azure CNI plug-in][azure-cni] and define your own virtual network and subnets. For more detailed information on how to plan out the required subnet ranges, see [configure advanced networking][use-advanced-networking]. Calico Network Policy could be used with either this same Azure CNI plug-in or with the Kubenet CNI plug-in.
7676

7777
The following example script:
7878

7979
* Creates a virtual network and subnet.
8080
* Creates an Azure Active Directory (Azure AD) service principal for use with the AKS cluster.
8181
* Assigns *Contributor* permissions for the AKS cluster service principal on the virtual network.
8282
* Creates an AKS cluster in the defined virtual network and enables network policy.
83-
* The *azure* network policy option is used. To use Calico as the network policy option instead, use the `--network-policy calico` parameter.
83+
* The *azure* network policy option is used. To use Calico as the network policy option instead, use the `--network-policy calico` parameter. Note: Calico could be used with either `--network-plugin azure` or `--network-plugin kubenet`.
8484

8585
Provide your own secure *SP_PASSWORD*. You can replace the *RESOURCE_GROUP_NAME* and *CLUSTER_NAME* variables:
8686

@@ -464,9 +464,9 @@ To learn more about policies, see [Kubernetes network policies][kubernetes-netwo
464464
[policy-rules]: https://kubernetes.io/docs/concepts/services-networking/network-policies/#behavior-of-to-and-from-selectors
465465
[aks-github]: https://github.com/azure/aks/issues
466466
[tigera]: https://www.tigera.io/
467-
[calicoctl]: https://docs.projectcalico.org/v3.6/reference/calicoctl/
467+
[calicoctl]: https://docs.projectcalico.org/v3.9/reference/calicoctl/
468468
[calico-support]: https://www.projectcalico.org/support
469-
[calico-logs]: https://docs.projectcalico.org/v3.6/maintenance/component-logs
469+
[calico-logs]: https://docs.projectcalico.org/v3.9/maintenance/component-logs
470470
[calico-aks-cleanup]: https://github.com/Azure/aks-engine/blob/master/docs/topics/calico-3.3.1-cleanup-after-upgrade.yaml
471471

472472
<!-- LINKS - internal -->

0 commit comments

Comments
 (0)