k8s - Deployment - 2/27/2021
How do you deploy your application in prod env?
We have to deploy multiple web servers
- New applicaiton build comes in
- How do upgrade?
- You may not want to update all at once. One at a time - (rolling update)
- What if you encounter on one of the instance and you have to rollback?
- If you want to have multiple change on your env, say application version, scaling env, resource allocation etc, you don't want to apply all all changes immediately, for the command is running, but pause your env, make the changes to your env and resume the change are done together.
All of these can be done through deployment.
- Each container is encapsulated in POD.
- Multiple PODs are deployed using RS or RC.
Deployment comes on top of RS or RC which allows us to upgrade the underline instances flawlessly
- using rolling updates.
- undo changes
- pause/resume as required
How to create deployment?
- Create deployment definition file
- Content of the definition file is similar to rs.
- Only we change is kind: Deployment
# cat dep-def.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: myappDep
labels:
app: myapp
type: front-end
spec:
template:
metadata:
name: myapp-pod
labels:
app: myapp
type: front-end
spec:
containers:
- name: nginx-controller
image: nginx
replicas: 3
selector:
matchLabels:
type: front-end
> kc create -f dep-def.yaml
> kc get deployments
Deployment automatically creates replicaSets
> kc get rs
you see the rs in the name of deployment
> kc get pods
you see the name of the pod with deployment.
Get all deployment, RS and POds
> kc get all
Visit the link for more detail
https://kubernetes.io/docs/reference/kubectl/conventions/
Create an nginx POD
# kc run nginx --image=nginx
Create POD manifest YAML file (-o yaml) don't create (--dry-run)
# kc run nginx --image=nginx --dry-run=client -o yaml
create deployment
# kc create deployment nginx --image=nginx
Create deployment def fine without creating it (--dry-run)
# kc create deployment mydep --image=nginx --dry-run=client -o yaml
generate with replicas
# kc create deployment mydep --image=nginx --replicas=3 --dry-run=client -o yaml > dep-def.yaml
# kc apply -f dep-def.yaml
Saturday, February 27, 2021
Day 25 - Kubernetes - Deployment
Subscribe to:
Post Comments (Atom)
Git branch show detached HEAD
Git branch show detached HEAD 1. List your branch $ git branch * (HEAD detached at f219e03) 00 2. Run re-set hard $ git reset --hard 3. ...
-
snmpconfig command allow you to managge snmpv1/v3 agent configuration on SAN switch. Event trap level is mapped with event severity level....
-
Firmware upgrade on HPE SuperDom Flex 280 - prerequisites tasks a. Set up repo b. Upload firmware to your webserver 1. For foundation so...
-
Disabling the Telnet protocol on Brocade SAN switches By default, telnet is enabled on Brocade SAN switches. As part of security hardening o...
No comments:
Post a Comment