Skip to content

kubectl diff feature always returns empty #61145

Closed
@toothbrush

Description

/kind bug
/sig cli
/area kubectl

Hello. This is my first interaction with the Kubernetes community, so please forgive me if i have left out any crucial details, or if, perhaps, this is PEBKAC after all!

I am keen to have a working kubectl diff feature, as described in #6284 and kubernetes/enhancements#491. I am running K8s v1.9.3 and realise that this feature is in alpha, but i thought i would ask anyway. We're not on v1.9.4 yet, but the changelog doesn't mention the diff feature.

What you expected to happen:

I have some services deployed to Kubernetes with YAML files, that has been working reliably. We always use kubectl apply -f ... to deploy things. When a service is already deployed, and i make a minor change in the config file, for example the service port, i expect to see that in the diff. Instead, kubectl gives no output and exits with a 0.

How to reproduce it (as minimally and precisely as possible):

Consider the file kube2iam.yaml:

apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: kube2iam
  namespace: kube-system
  labels:
    app: kube2iam
spec:
  template:
    metadata:
      labels:
        name: kube2iam
    spec:
      hostNetwork: true
      tolerations:
      - key: "role"
        operator: "Equal"
        value: "controller"
      containers:
        - image: jtblin/kube2iam:latest
          name: kube2iam
          args:
            - "--auto-discover-default-role"
            - "--verbose"
          ports:
            - containerPort: 8181
              hostPort: 8181
              name: http

I make sure that it is correctly running on the cluster:

kubectl apply -f ./kube2iam.yaml
daemonset "kube2iam" unchanged

Great, looking good. Now, i change the spec.template.spec.containers[0].image value to use Docker image tag master and save.

Now, i run:

kubectl alpha diff -f ./kube2iam.yaml

The stderr/stdout output is empty, and the exit code is 0.

Anything else we need to know?:

Environment:

  • Kubernetes version:

Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.3", GitCommit:"d2835416544f298c919e2ead3be3d0864b52323b", GitTreeState:"clean", BuildDate:"2018-02-09T21:50:44Z", GoVersion:"go1.9.4", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.3+coreos.0", GitCommit:"f588569ed1bd4a6c986205dd0d7b04da4ab1a3b6", GitTreeState:"clean", BuildDate:"2018-02-10T01:42:55Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"linux/amd64"}

Metadata

Assignees

Labels

area/kubectlkind/bugCategorizes issue or PR as related to a bug.sig/cliCategorizes an issue or PR as relevant to SIG CLI.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions