Open jrcast opened 1 month ago
Have you verified that the kubectl edit
actually updated your service?
@jrcast have you checked if kubectl command executed successfully without error ?
/remove-kind bug
/kind support
Can confirm this happens when you make changes using kubectl edit
, and it does seem to have something to do with server side apply.
If you use the --save-config
flag with edit, then kubectl diff
will work:
kubectl edit service example --save-config
$ kubectl diff -f my-svc.yaml
diff -u -N /tmp/LIVE-3530718821/v1.Service.default.example /tmp/MERGED-1768176721/v1.Service.default.example
--- /tmp/LIVE-3530718821/v1.Service.default.example 2024-05-28 11:44:49.052930430 -0400
+++ /tmp/MERGED-1768176721/v1.Service.default.example 2024-05-28 11:44:49.056930322 -0400
@@ -22,10 +22,6 @@
port: 80
protocol: TCP
targetPort: service-port
- - name: shouldntbehere
- port: 8080
- protocol: TCP
- targetPort: service-port
selector:
app.kubernetes.io/instance: example
sessionAffinity: None
But if you use that flag, it's going to add the kubectl.kubernetes.io/last-applied-configuration
annotation, which shouldn't be a requirement for diff.
/remove-kind support /kind bug
/triage accepted /priority backlog
What happened:
kubectl diff
is not detecting diffs between a service's manifest file and the modified service object in Kubernetes. I tried both client-side or server-side mode without success.What you expected to happen:
kubectl diff
identifies the diffHow to reproduce:
kubectl create -f my-svc.yaml
. Wheremy-svc.yaml
is:kubectl edit
, modify the K8s service. i.e. Add an extra port.Anything else we need to know?:
Environment:
kubectl version
): 1.27 on both server/client. Also tried 1.30 with same results.cat /etc/os-release
): Ubuntu 22.04.4 LTS