ReplicaSets contd..
- Finding the ReplicaSet from Pod
- Scaling ReplicaSets:
- Manual Scaling: One way is to change the replicas in yaml file and apply the file again
- Auto Scaling: When we autoscale horizontal pod autoscaler (hpa) will be created
- AutoScaling can be done by create a manifest as well Refer Here
Namespaces
- K8s namespaces provide a mechanism for isolating a group of resources with in a single cluster
- Name of the resources should be unique with in a namespace, but not across namespaces.
- Namespace-based scoping is applicable only for namespaced objects (Deployments, Services, Pods, Replicasets etc ) and not Cluster-wide Objects (Storage Classes, Nodes, Persistent Volumes etc)
Activity6: Create a Replicaset Which runs 2 replicas of jenkins
- The image to be used is jenkins:1.651.2
- replicas should be 2
- create labels
- app: jenkins
- version: 1.651.2
- port is 8080
- Refer Here for the manifest created
- Lets create the replica set
- The representation of the work done by us
- Now we can easily create a loadbalancer using k8s object called as service. The only thing service can do is group resources /select resources based on labels and give one interface for access.
- To access the pods scaled we can use service as shown below
- Now lets create a Service
- Refer Here
- Refer Here for the service manifest
- Now if we apply the service, jenkins will be accessible on each node on port 32700 which will forward the request to service (k8s) and from there to the Pod
- Service info is injected as env variables in all the pods to be created after server
- Next Steps:
- AKS and EKS
- Service Discovery
- Zero Downtime Deployments (rollouts and rollbacks)
- Other => Workload Resources
- Storage in K8s
- RBAC