Kubernetes- Deployment
- Defines how to deploy application in production environment.
Scenarios
- Old instance running - Multiple Pod having applications are running in production environment.
- New version of application is available - need to upgrade seamlessly- without any downtime.
- Rolling update
- For this we don't want to upgrade all of them at once as this may impact accessibility.
- One by one upgrade - And we might want to upgrade one after other.
- In case of failure - we should be able to rollback the upgrade.
- Multiple change to environment -
- Ex - Scaling the environment, Modifying resource allocation etc.
- And this change should be done for all PODS together and then activated for all Pods as the same time.
Kubernetes Deployment
- Comes at the top of the hierarchy.
- Comes at top of Pod and Replica Set.
- Available with
- Rolling update
- Undo changes
- Pause changes
- Resume changes
How to create deployment
Yaml file
- same as ReplicaSet except for change in KIND.
apiVersion: apps/v1
kind: Deployment << Only change done for Deployment
metadata:
name: myapp-replicaset
labels:
app: myapp
type: front-end
spec:
template: <<< Here need to provide template for POD. We just to insert metadata + spec section of POD.
metadata:
name: myapp-pod
labels:
app: myapp
type: front-end
spec:
containers:
name: nginx-container
image: nginx
replicas: 3 <<< This is sibling of template
selector:
matchLabels:
type: front-end
0 comments:
Post a Comment