Need to try this myself
sleep.py Code to remove IP from the interface
import time
import os
print("Going to Remove IP")
os.system("ip addr flush dev eth0")
print("Done Removing IP")
while True:
time.sleep(1)
Dockerfile to create ubuntu image ubu:sleep
FROM ubuntu:16.04
RUN apt update
RUN apt install python -y
RUN apt install curl -y
RUN apt install iproute2 -y
RUN apt install net-tools -y
RUN apt install vim -y
COPY sleep.py /
ENTRYPOINT ["python", "/sleep.py" ]
YAML to create POD
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: ubu-sleep
labels:
name: ubu-sleep
spec:
replicas: 1
selector:
matchLabels:
name: ubu-sleep
template:
metadata:
labels:
name: ubu-sleep
annotations:
NETSCALER_AS_APP: "True"
spec:
containers:
- name: ubu-sleep
image: "ubu:sleep"
imagePullPolicy: IfNotPresent
securityContext:
privileged: true
nodeSelector:
node-label: node134