Server Fault Asked by Grilse on November 7, 2021
kubectl
can diff configuration (blog, docs).
On Linux, this works fine (WSL, Ubuntu 18, bash). It gives me sensible output similar to the following.
$ kubectl diff --filename some-resources.yaml
diff -u -N /tmp/LIVE-022965340/apps.v1.Deployment.… /tmp/MERGED-396067851/apps.v1.Deployment.…
--- /tmp/LIVE-022965340/apps.v1.Deployment.… 2020-07-20 17:06:21.444811700 +0200
+++ /tmp/MERGED-396067851/apps.v1.Deployment.… 2020-07-20 17:06:21.470315500 +0200
@@ -6,7 +6,7 @@
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"apps/v1",…
creationTimestamp: "2020-07-16T15:13:03Z"
- generation: 1
+ generation: 2
name: …
namespace: …
resourceVersion: "32827467"
@@ -121,7 +121,7 @@
- chown www-data:www-data /files/ -R;chmod -R 755 /files/; chmod -R g+ws /files/
command:
- /bin/bash
- - -c
+ - -cv
image: …
imagePullPolicy: IfNotPresent
name: init-sites-volume
On PowerShell, kubectl diff
fails (PowerShell 7, Windows 10).
PS > kubectl diff --filename some-resources.yaml
error: failed to run "diff": executable file not found in %PATH%
It seems that either kubectl
can’t find an executable named diff
, or it trips up over diff
being an alias for Compare-Object
, which of course has very different syntax than Linux’ diff
.
Is it possible to get kubectl diff
to work on PowerShell? If so, which diff-tool should I install and what should $env:KUBECTL_EXTERNAL_DIFF=…
be set to?
This can be done by installing DiffUtils for Windows. The kubectl diff
is using the Unix diff
program so Windows will need some help with this. Simply:
Install the DiffUtils
Make sure the bin folder is mapped in your Win10 PATH variable (should be done automatically)
Restart the machine
Please let me know if that helped.
Answered by Wytrzymały Wiktor on November 7, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP