7.Deploy ReplicaSet in Kubernetes Cluster
Source: Dev.to
Lab Information
The Nautilus DevOps team is preparing to deploy applications on a Kubernetes cluster for migration. One task is to create a ReplicaSet with the following specifications:
- Image:
httpd:latest - ReplicaSet name:
httpd-replicaset - Labels:
app=httpd_app,type=front-end - Container name:
httpd-container - Replica count:
4
Note: The
kubectlutility onjump_hostis already configured to interact with the Kubernetes cluster.
ReplicaSet Manifest (httpd-replicaset.yaml)
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: httpd-replicaset
labels:
app: httpd_app
type: front-end
spec:
replicas: 4
selector:
matchLabels:
app: httpd_app
type: front-end
template:
metadata:
labels:
app: httpd_app
type: front-end
spec:
containers:
- name: httpd-container
image: httpd:latest
ports:
- containerPort: 80
Apply the ReplicaSet
kubectl apply -f httpd-replicaset.yaml
Verify the Deployment
-
Check that the ReplicaSet was created
kubectl get replicaset httpd-replicaset -
List the Pods created by the ReplicaSet
kubectl get pods -
Get detailed information about the ReplicaSet
kubectl describe replicaset httpd-replicaset
Resources & Next Steps
- Full Code Repository: KodeKloud Learning Labs
- More Deep Dives: Whispering Cloud Insights
- Join Discussion: DEV Community
- Connect on LinkedIn: LinkedIn Profile
Credits
- All labs are from KodeKloud.