netclient-template-doks.yaml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. apiVersion: apps/v1
  2. kind: DaemonSet
  3. metadata:
  4. name: netclient-1
  5. labels:
  6. app: netclient-1
  7. spec:
  8. selector:
  9. matchLabels:
  10. app: netclient-1
  11. template:
  12. metadata:
  13. labels:
  14. app: netclient-1
  15. spec:
  16. hostNetwork: true
  17. containers:
  18. - name: netclient-1
  19. image: gravitl/netclient:0.9.2-doks
  20. env:
  21. - name: NETCLIENT_ROAMING
  22. value: "no"
  23. - name: NETCLIENT_PORT
  24. value: "51821"
  25. - name: NETCLIENT_IS_STATIC
  26. value: "yes"
  27. - name: NETCLIENT_ENDPOINT
  28. valueFrom:
  29. fieldRef:
  30. fieldPath: status.hostIP
  31. - name: TOKEN
  32. value: "<token>"
  33. volumeMounts:
  34. - mountPath: /etc/netclient
  35. name: etc-netclient
  36. - mountPath: /usr/bin/wg
  37. name: wg
  38. securityContext:
  39. privileged: true
  40. volumes:
  41. - hostPath:
  42. path: /etc/netclient
  43. type: DirectoryOrCreate
  44. name: etc-netclient
  45. - hostPath:
  46. path: /usr/bin/wg
  47. type: File
  48. name: wg
  49. ---
  50. apiVersion: apps/v1
  51. kind: DaemonSet
  52. metadata:
  53. name: wireguard-controller
  54. labels:
  55. app: wireguard-controller
  56. spec:
  57. selector:
  58. matchLabels:
  59. app: wireguard-controller
  60. template:
  61. metadata:
  62. labels:
  63. app: wireguard-controller
  64. spec:
  65. hostNetwork: true
  66. containers:
  67. - image: gravitl/netclient:0.9.2-doks
  68. imagePullPolicy: IfNotPresent
  69. name: wg-installer
  70. command: ['bash', '-c']
  71. args:
  72. - while [ 1 ];
  73. do if ! command -v wg &> /dev/null;
  74. then echo "wireguard not installed, installing";
  75. echo 'deb http://deb.debian.org/debian buster-backports main contrib non-free' > /etc/apt/sources.list.d/buster-backports.list;
  76. apt update;
  77. sudo apt -y install linux-headers-$(uname --kernel-release);
  78. apt -y install wireguard wireguard-tools;
  79. else echo "wireguard installed";
  80. sleep 300;
  81. fi;
  82. done
  83. securityContext:
  84. privileged: true
  85. volumeMounts:
  86. - name: rootfolder
  87. mountPath: /
  88. volumes:
  89. - hostPath:
  90. path: /
  91. type: ""
  92. name: rootfolder