DevOps Buzz
Search…
Bash / Shell
Bitbucket
Distros
Elasticsearch
General
Guidelines / Standards
microk8s
Prometheus
RabbitMQ
VirtualBox
Node management

Change kernel parameters

Pod’s securityContext will most likely result in SysctlForbidden erros.
To workaround, create DaemonSet.
1
apiVersion: extensions/v1beta1
2
kind: DaemonSet
3
metadata:
4
name: more-fs-watchers
5
namespace: kube-system
6
labels:
7
app: more-fs-watchers
8
spec:
9
template:
10
metadata:
11
labels:
12
name: more-fs-watchers
13
spec:
14
hostNetwork: true
15
hostPID: true
16
hostIPC: true
17
initContainers:
18
- command:
19
- sh
20
- -c
21
- sysctl -w fs.inotify.max_user_watches=524288;
22
image: alpine:3.6
23
imagePullPolicy: IfNotPresent
24
name: sysctl
25
resources: {}
26
securityContext:
27
privileged: true
28
volumeMounts:
29
- name: sys
30
mountPath: /sys
31
containers:
32
- resources:
33
requests:
34
cpu: 0.01
35
image: alpine:3.6
36
name: sleepforever
37
command: ["tail"]
38
args: ["-f", "/dev/null"]
39
volumes:
40
- name: sys
41
hostPath:
42
path: /sys
Copied!

Reboot node

  • Manually, through the Azure portal or the Azure CLI.
  • By upgrading your AKS cluster. The cluster upgrades cordon and drain nodes automatically and then bring a new node online with the latest Ubuntu image and a new patch version or a minor Kubernetes version. For more information, see Upgrade an AKS cluster.
  • By using Kured, an open-source reboot daemon for Kubernetes. Kured runs as a DaemonSet and monitors each node for the presence of a file that indicates that a reboot is required. Across the cluster, OS reboots are managed by the same cordon and drain process as a cluster upgrade.
References

SSH to nodes

Set your subscription.
1
az account set --subscription "MY-SUBSCRIPTION"
Copied!
Set an env var with your cluster resources RG.
1
CLUSTER_RESOURCE_GROUP=MC_my-aks-name
Copied!
Add your RSA key to the node.
1
az vm user update \
2
--resource-group $CLUSTER_RESOURCE_GROUP \
3
--name PUT-YOUR-NODE-NAME-HERE \
4
--username azureuser \
5
--ssh-key-value ~/.ssh/id_rsa.pub
Copied!
Get your node IP.
1
az vm list-ip-addresses --resource-group $CLUSTER_RESOURCE_GROUP -o table
Copied!
Run a pod.
1
kubectl run -it --rm aks-ssh --image=debian
Copied!
Install SSH client.
1
apt-get update && apt-get install openssh-client vim -y
Copied!
Setup the id_rsa file.
1
mkdir ~/.ssh
2
vi ~/.ssh/id_rsa
3
# Paste your id_rsa
4
chmod 600 ~/.ssh/id_rsa
Copied!
SSH to your node.
Copied!