You can set up SSH to an AKS node as detailed here using a privileged container pod. Once you have SSH-d into the node, in case of Linux nodes, from a different terminal shell you can copy files from your local machine to the AKS node using:
kubectl get pods
NAME READY STATUS RESTARTS AGE
node-debugger-aks-nodepool1-xxxxxxxx-vmssxxxxxx-xxxxx 1/1 Running 0 21s
kubectl cp /source/path node-debugger-aks-nodepoolname-xxxxxxxx-vmssxxxxxx-xxxxx:/host/path/to/destination
[Note: In the destination please remember to prepend the desired destination path on the host with /host]
In case of Windows nodes, once the SSH connection is set up as detailed here, you can copy files from your local machine to the Windows node using:
scp -o 'ProxyCommand ssh -p 2022 -W %h:%p azureuser@127.0.0.1' /source/path azureuser@<node-private-IP>:/path/to/destination
Reference for kubectl cp command
I imagine every time it scales, the file previously copied will be available in every VM so this does not need to happen on every scale event?
To the contrary, when the AKS node pool scales out, the VMSS instances are created from the VMSS Model. This Model is defined by the Microsoft.ContainerService
Resource Provider. More on VMSS model and instance view here.
When you make any changes to the node's file system, the changes shall be available only to that corresponding VMSS instance. Such manual changes are not persisted if the node undergoes a node image upgrade, Kubernetes version upgrade or reconcile operation. Also if this node gets scaled down by the AKS cluster, the changes will be lost.
Instead we recommend using DaemonSets
with Read-Write hostPath
volume mounts where it can add files to on the host node. Since Daemonset is a Kubernetes construct and the Daemonset controller creates one replica of the Daemonset on each node (except virtual nodes; Reference) and there shall consistently be aviable even if the node undergoes an update or reconcile operation. When the node pool is scaled up new nodes shall also get a replica of the DaemonSet each.
For Azure Virtual Machine Scale Sets in general, the easiest ways to copy files between your local machine and an Azure VMSS instance would be: