-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDetectDuplicateIpAddress.yaml
More file actions
49 lines (44 loc) · 1.36 KB
/
DetectDuplicateIpAddress.yaml
File metadata and controls
49 lines (44 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: detect-dup-ip
labels:
app: detect-dup-ip
spec:
selector:
matchLabels:
name: detect-dup-ip
template:
metadata:
labels:
name: detect-dup-ip
spec:
securityContext:
windowsOptions:
hostProcess: true
runAsUserName: "NT AUTHORITY\\SYSTEM"
hostNetwork: true
containers:
- name: detect-dup-ip
image: mcr.microsoft.com/dotnet/framework/samples:aspnetapp
command:
- powershell.exe
- -command
- |
Write-Host "Detecting duplicate IP addresses on the host..."
$BaseDir = "c:\k\debug"
ipmo $BaseDir\hns.v2.psm1 -Force
while($true){
$ipAddresses = ((Get-HnsEndpoint).IpConfigurations).IpAddress
$duplicateIpAddr = $ipAddresses | Group-Object | Where-Object { $_.Count -gt 1 }
if($duplicateIpAddr.Count -gt 0){
break
}
Start-Sleep -Seconds 300
}
Write-Host "Duplicate IP addresses found on the host, collecting windows logs..."
& "$BaseDir\collect-windows-logs.ps1"
securityContext:
privileged: true
nodeSelector:
kubernetes.azure.com/os-sku: Windows2022