Skip to content

Instantly share code, notes, and snippets.

@cxhercules
Last active August 12, 2018 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cxhercules/38f2d84c1c91dce480aadff0b2c82791 to your computer and use it in GitHub Desktop.
Save cxhercules/38f2d84c1c91dce480aadff0b2c82791 to your computer and use it in GitHub Desktop.
Recover item you have deleted from helm deployment

I looked around and did not find an answer to this so just sharing.

I deployed a jenkins chart using below command:

helm install -n cd stable/jenkins -f jenkins/values.yaml --version 0.16.6 --wait

Then I wanted to remove external load balancer for a bit, just testing some things so removed it by:

kubectl delete service cd-jenkins

Now to get it back, I did not see a helm repair type of command, but finally landed on upgrade would do something similar.

helm upgrade cd stable/jenkins -f jenkins/values.yaml --version 0.16.6

This ran very quickly and did what I expected without replacing anything that was not necessary. As you can see below pods were not replaced.

kubectl get svc
NAME               TYPE           CLUSTER-IP      EXTERNAL-IP      PORT(S)          AGE
cd-jenkins         LoadBalancer   10.47.255.68    123.345.678.901   8080:32091/TCP   9m

kubectl get pods
NAME                        READY     STATUS    RESTARTS   AGE
cd-jenkins-8568f887-ghtj5   1/1       Running   0          10h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment