AksNodePublicIPController

command module
v0.0.0-...-975d2cd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2020 License: MIT Imports: 28 Imported by: 0

README

Build Status Go Report Card Software License PRs Welcome unofficial Google Analytics for GitHub

AksNodePublicIPController

Azure Kubernetes Service does not currently have a way to automatically assign Public IPs to worker nodes/virtual machines. This project aims to solve this problem by utilizing a custom Kubernetes controller (based on sample-controller) and using Azure SDK for Go. The ID for the new Public IPs is always "ipconfig-" + name of the Node/Virtual Machine. It also assigns a Kubernetes Label to the Node, with name "HasPublicIP" and value "true".

Deployment

AKS clusters using Availability Sets

(This is probably what you're using)

If you have an RBAC enabled cluster, just run:

kubectl create -n kube-system -f https://raw.githubusercontent.com/dgkanatsios/AksNodePublicIPController/master/deploy.yaml
# this gets created into *kube-system* namespace, change it on the deploy.yaml

else, run:

kubectl create -f https://raw.githubusercontent.com/dgkanatsios/AksNodePublicIPController/master/deploy-no-rbac.yaml
Alternatives

If you're looking for a non-Kubernetes native solution, you should check out the AksNodePublicIP project, it uses Azure Functions and Azure Event Grid technologies.

AKS clusters using Virtual Machine Scale Sets

If you have created an AKS cluster using Virtual Machine Scale Set (VMSS) functionality, then the process is easier, since you don't need to deploy anything. What you need to do is:

  • Visit resources.azure.com to view your deployed Azure resources
  • Find the resource group where your AKS resources are deployed. It should have a name like MC_aksInstanceName_aksResourceGroupName_dataCenterLocation
  • Find and extend your VMSS information. VMSS should have a name like aks-nodepool1-34166363-vmss
  • Edit it and add the following JSON into ipConfigurations.properties section (source):
"publicIpAddressConfiguration": {
    "name": "pub1"
}

To better understand where to place it, check here

  • Press Patch or Put on the UI. VMSS should now be configured so that newly created VMs get a Public IP by default
  • Execute a scale out and a scale in operation on the cluster so existing VMs get a Public IP
  • Run kubectl get node -o wide and verify that all your Nodes have got a Public IP

To debug, you should run it like:

TENANT_ID=XXX SUBSCRIPTION_ID=XXX AAD_CLIENT_ID=XXX AAD_CLIENT_SECRET=XXX LOCATION=XXX RESOURCE_GROUP=XXX go run . --kubeconfig=~/.kube/config-aksopenarena

after getting the env details via this Pod:

apiVersion: v1
kind: Pod
metadata:
  name: busybox
spec:
  containers:
  - image: busybox
    command: ["cat","/akssp/azure.json"]
    name: busybox
    volumeMounts:
      - name: akssp
        mountPath: /akssp
  restartPolicy: Never
  volumes:
  - name: akssp
    hostPath:
      path: /etc/kubernetes
      type: Directory
kubect logs busybox -f

Kudos to Andreas Pohl for the guidance with VMSS

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL