Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kubectl command can not overwrite the service or deployment which be changed by manual update. #975

Closed
Darren-wh opened this issue Nov 6, 2020 · 8 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@Darren-wh
Copy link

Darren-wh commented Nov 6, 2020

Kubectl command can not overwrite the service or deployment which be changed by manual update. (for examples like service port or containers port)
1.Preparing the deployment and service
2.use the kubectl command to deploy service.
3.using the "kubectl edit deployment deployment" or service to add new Containers configuration and save.
Then kubernetes will do a rolling update.
4.using the kubectl command with old deployment and service code (without new Containers port) to deploy service.
Then the kubernetes will do a rolling update. And you can check the service or deployment, you will find new Containers configuration is still there., it doesn't be to overwrite by the old version.
5. The service has been updated , but the new add port configuration still.

for examples:
old service:

apiVersion: v1
kind: Service
metadata:
  name: test01
  namespace: ryu-dev
spec:
  selector:
    app: test-api
  ports:
    - name: test-api
      port: 8080
      targetPort: 8080
      protocol: TCP

kubectl edit service (add new port)

apiVersion: v1
kind: Service
metadata:
  name: test01
  namespace: ryu-dev
spec:
  selector:
    app: test-api
  ports:
    - name: test-api
      port: 8080
      targetPort: 8080
      protocol: TCP
    - name: test02-api
      port: 9100
      targetPort: 9100
      protocol: TCP

Then use the old version to apply the service. The service has been updated, but the new add port configuration still there.

@Darren-wh Darren-wh added the kind/bug Categorizes issue or PR as related to a bug. label Nov 6, 2020
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Nov 6, 2020
@k8s-ci-robot
Copy link
Contributor

@Darren-wh: This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@eddiezane
Copy link
Member

/assign @dougsland

@k8s-ci-robot
Copy link
Contributor

@eddiezane: GitHub didn't allow me to assign the following users: dougsland.

Note that only kubernetes members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/assign @dougsland

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@dougsland
Copy link
Member

/assign

@eddiezane
Copy link
Member

May be slightly related to #906

@dougsland
Copy link
Member

dougsland commented Dec 16, 2020

If I understood correctly:

first you created a service (manifest.yaml):

apiVersion: v1
kind: Service
metadata:
  name: test01
  namespace: ryu-dev
spec:
  selector:
    app: test-api
  ports:
    - name: test-api
      port: 8080
      targetPort: 8080
      protocol: TCP

Step 1:

$ kubectl apply -f manifest.yaml

Second you update it manually to add a new port:

$ kubectl edit svc test01 -n ryu-dev
<snip>
 - name: test02-api
      port: 9100
      targetPort: 9100
      protocol: TCP
<snip>

In the final step you wanna get back in the first stage doing:

$ kubectl apply -f manifest.yaml

Correct? If yes, I can't see anything wrong. It will only change the data the contains in that yaml.
In that case, not including the additional port.

If you wanna get back in the original state from yaml:

$ kubectl replace --force -f manifest.yaml

If not, please help me understand your use case :)

@dougsland
Copy link
Member

no response, closing this one for now. Feel free to re-open in case you still think this report is valid.
/close

@k8s-ci-robot
Copy link
Contributor

@dougsland: Closing this issue.

In response to this:

no response, closing this one for now. Feel free to re-open in case you still think this report is valid.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
None yet
Development

No branches or pull requests

4 participants