acs-engine icon indicating copy to clipboard operation
acs-engine copied to clipboard

Azure CNI w/ bring your own VNET

Open jackfrancis opened this issue 9 years ago • 8 comments

This issue will track the enabling of "bring your own" VNET functionality using Azure CNI networking implementation.

At present, hooking up a pre-existing VNET to a new cluster deployment manifest is manual. We continually test this manual feature with the following process:

  1. Create a new VNET using the script here:
  • https://github.com/Azure/acs-engine/blob/master/examples/vnet/k8s-vnet-predeploy.sh
    • depends upon an existing resource group mapped to the env var RESOURCE_GROUP
    • will inject the resultant vnet reference strings into an api model path, mapped to the env var CLUSTER_DEFINITION
  1. Generate ARM template data using the modified api model path.
  • bin/acs-engine generate --api-model $CLUSTER_DEFINITION
  1. Deploy the cluster given the resultant ARM template data from the above step.
  • az group deployment create -n <name-of-deployment> -g $RESOURCE_GROUP --template-file _output/<path-to-template-file> --parameters _output/<path-to-parameters-file>
  1. Add the route table to the VNET subnet using the script here:
  • https://github.com/Azure/acs-engine/blob/master/examples/vnet/k8s-vnet-postdeploy.sh
    • depends upon an mapping the env var RESOURCE_GROUP to the $RESOURCE_GROUP referenced in all of the above steps

We should aim to keep the above flow 100% working for existing kubenet configurations w/ bring your own VNET, and make "networkPolicy": "azure" configurations work as well. In practice the final route table step may not be required due to native Azure CNI characteristics, but that's an implementation detail. The important thing is we don't want to add any new configuration vectors. We simply want a working process to support api models that look like this:

{
  "apiVersion": "vlabs",
  "properties": {
    "orchestratorProfile": {
      "orchestratorType": "Kubernetes",
      "kubernetesConfig": {
        "networkPolicy": "azure"
      }
    },
    "masterProfile": {
      "count": 1,
      "dnsPrefix": "<dns-prefix>",
      "vmSize": "Standard_D2_v2",
      "vnetSubnetId": "/subscriptions/<sub-id>/resourceGroups/<resource-group>/providers/Microsoft.Network/virtualNetworks/<vnet-name>/subnets/<subnet-name>,
      "firstConsecutiveStaticIP": "10.239.255.239"
    },
    "agentPoolProfiles": [
      {
        "name": "agentpri",
        "count": 3,
        "vmSize": "Standard_D2_v2",
        "vnetSubnetId": "/subscriptions/<sub-id>/resourceGroups/<resource-group>/providers/Microsoft.Network/virtualNetworks/<vnet-name>/subnets/<subnet-name>",
        "availabilityProfile": "AvailabilitySet"
      },
<etc...>

(firstConsecutiveStaticIP makes sense in the context of the VNET-generating scripts referenced above, that's not supposed to be a static requirement.)

jackfrancis avatar Nov 21 '17 23:11 jackfrancis

@xtophs @dtzar

jackfrancis avatar Nov 21 '17 23:11 jackfrancis

@slack @khenidak @sauryadas

jackfrancis avatar Nov 22 '17 17:11 jackfrancis

@jackfrancis We have tested and this works if customer specifies vnetCIDR in the cluster config. We need the vnet address space for internet connectivity to work (the iptables rule).

Are you asking that customer should not have to specify the vnetCIDR for the pre-existing Vnet?

sharmasushant avatar Nov 23 '17 00:11 sharmasushant

@sharmasushant No, if we have a working pattern with the existing code, we should use it. Thanks!

I'm realizing, also, that step 4 above (add route table to VNET) should not be required w/ Azure CNI. Can you confirm that that plumbing is only required for kubenet + Azure VNET implementations?

jackfrancis avatar Nov 27 '17 17:11 jackfrancis

// TODOs:

  • add validation for Azure CNI + bring your own VNET configs: require vnetCIDR property
    • @jackfrancis
  • improve documentation
    • @jackfrancis

jackfrancis avatar Nov 27 '17 18:11 jackfrancis

I just deployed a k8s 1.9.6 with customvnet adn azure cni, the cluster is up adn kubcetl works, but there is not route table crated and using kubectl proxy I cannot access dashboard

Error: 'net/http: HTTP/1.x transport connection broken: malformed HTTP response "\x15\x03\x01\x00\x02\x02"'
Trying to reach: 'http://10.192.0.51:8443/'

My subnet is 10.192.0.0/10 and firt ip is 10.255.255.5

jalberto avatar Mar 31 '18 01:03 jalberto

@jalberto did you include a vnetCidr value in the masterProfile api model that is within the IP space of your subnet (10.192.0.0/10)?

jackfrancis avatar Apr 02 '18 16:04 jackfrancis

yes

On Mon, 2 Apr 2018 at 18:55 Jack Francis [email protected] wrote:

@jalberto https://github.com/jalberto did you include a vnetCidr value in the masterProfile api model that is within the IP space of your subnet (10.192.0.0/10)?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Azure/acs-engine/issues/1815#issuecomment-377977071, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGGV4CepUzzA_WqSTIo12nKexdW8H0Vks5tklfugaJpZM4QmqkS .

jalberto avatar Apr 02 '18 21:04 jalberto