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

execute kubectl rolling restart #440

Open
terryzwt opened this issue Dec 10, 2024 · 3 comments
Open

execute kubectl rolling restart #440

terryzwt opened this issue Dec 10, 2024 · 3 comments

Comments

@terryzwt
Copy link

Can I run this command with the library?
kubectl rollout restart -n default deployment/test

@dev-maniac
Copy link

I don't know, if this is even a feature of kubernetes itself (or rather its API) or kubectl...

I emulated this by loading deployment and modifying an annotation in pod spec / pod template - or by applying same deployment with different annotation.

There's a chance that kubectl also just does that.

@web-engineer
Copy link

If you update a deployments chart it should update and trigger a rolling restart - we use this with YAML chart templates and apply the changes and it works well.

If you use the pull policy of always or use a different tag for your image it should get a fresh image too.

@web-engineer
Copy link

Just hit this myself - when a config map meant a deployment needed a kick...

$dep = $instance->getDeploymentByName('<deployment-name>', '<namespace>');
$spec = $dep->getSpec('template');
$spec['metadata']['labels']['patch_at'] = (string)time();
$dep->setSpec('template', $spec)->update();

Patching the spec in anyway then means the update triggers a rolling restart - there might be a neater way - but hope that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants