Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

217
Views
Way to stop deploy wrong kubernetes environment

We have a set of kubernetes yamls which is management by kustomize and they will be deployed to different clusters. Each cluster is slightly different which means every environment will have a sub directory (environ/<envname>) including some special kustomization overwrite.

We will manually deploy new version to different environments by command kubeclt apply -k environ/env. But sometimes we do stupid thing like this: kubectl apply -k environ/env1 to the cluster env2 . So is there some method to stop doing a kubectl apply to a wrong environment?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

This is a community wiki answer. Feel free to expand it.

If you are aware that you made a mistake and want to cancel the command right away than there are some options for you:

  • $ kill -9 $! will kill the most recent process executed by the command ($! represents its process ID).

  • Suspend the current process by pressing Ctrl+z and then kill it using kill -9 %% or kill -9 %+. More details regarding this approach can be found here.

EDIT:

Including the solution proposed by VASャ from the comments:

I'd use shell scripts and different configs for each cluster, like that: deploy-cluster1.sh where I'd have kubectl --kubeconfig .kube/cluster1 apply -k environ/cluster1 or even shorter: deploy.sh env1 where deploy.sh contains: kubectl --kubeconfig .kube/$1 apply -k environ/$1

More details regarding that approach can be found here.

over 4 years ago · Santiago Trujillo Report

0

Recently I got a new solution here.

direnv which can change env after switch into different directories this force me to switch the KUBECONFIG env. Follow Mastering the KUBECONFIG file to get more details.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!