How do I update the args for a Kubernetes deployment
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Updating the arguments for a Kubernetes deployment is a common task that can be crucial for refining application behavior without needing to overhaul the entire deployment setup. This article outlines the steps required to modify deployment arguments, provides a technical breakdown of the underlying processes, and offers best practices for managing these updates efficiently.
Understanding Kubernetes Deployments
A Kubernetes Deployment is an API object that manages a desired number of pod instances for an application, deployment update, or rollback features, along with scaling capabilities. It provides declarative updates and orchestration for pods in an application deployment.
Components of a Deployment
Key components in a Kubernetes Deployment configuration include:
- Metadata: Identifying information, such as name and labels.
- Spec: The specification defining the desired state of the deployment, including
replicas,selector, andtemplate. - Containers: The application containers, defined under the
templatesection, include the image, ports, and arguments.
Updating the Arguments for a Kubernetes Deployment
Why Update Arguments?
Arguments (args) are passed to containers within the pod to modify the way the application behaves. Updating these allows you to change the behavior or configuration without altering the container image.
Steps to Update Deployment Arguments
- Identify the Deployment: Use
kubectl get deploymentsto list all deployments and identify the one you wish to update. - Modify the Deployment Configuration: You can update arguments in the container specs directly by using either
kubectl editor by creating a new YAML file.- Using
kubectl edit: - Using a YAML File:
- name: web-app
- --port=8080
- --log-level=info
- name: web-app
- --port=8080
- --log-level=debug
- Rolling Updates: By default, Kubernetes performs a rolling update. It will update the pods gradually with new arguments, minimizing downtime.
- Environment Variables: If arguments depend on environment variables, ensure these are defined correctly.
- Idempotency: Ensure that the updated deployment is intended to be idempotent, meaning repeated applications should not result in unexpected changes.
- Version Control: Keep your YAML files under version control to track changes.
- Testing: Test configuration changes in a development or testing environment before deploying to production.
- Monitoring: Use tools like Prometheus and Grafana to monitor application logs and performance after deploying changes.
Related reading
- How do I use minikube's DNS?
- How do we install dynamic modules non support officially on Nginx Ingress Controller? terraform, helm chart
- How do you add multiple config files to configMap with kustomize configMapGenerator by using a pattern/regex/...?
- How do you cleanly list all the containers in a kubernetes pod?
- How do I use Docker environment variable in ENTRYPOINT array?
- How do I work out why an ECS health-check is failing?
- How do I use sudo to redirect output to a location I don't have permission to write to?
- How do I watch a file for changes?

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.