Replica Sets

With Pods we manage to declare the definition of one unit of deployment, e.g. one instance of Nginx. In a cluster environment we probably want to have more than one instances of our applications for example for the sake of redundancy and throughput.

In order to manage this need we'll use Replica Sets. A Replica Set defines the Pods that needs to run and the number of their replicas.

We'll use the same example of Nginx before but now we'll run multiple instances.

NOTE: Make sure you are pointing to the "kubernetic-tutorial" namespace.

Go to the tutorial chart repo and run the replicaset-nginx chart.

Here is the Replica Set definition:

apiVersion: extensions/v1beta1
kind: ReplicaSet
metadata:
  name: nginx
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
      template: replicaset
    matchExpressions:
      - {key: app, operator: In, values: [nginx]}
  template:
    metadata:
      labels:
        app: nginx
        template: replicaset
    spec:
      containers:
      - name: nginx
        image: nginx:1.11
        ports:
        - containerPort: 80
        resources:
          requests:
            cpu: 100m
            memory: 100Mi

Now go to the Replica Sets section. You'll see the nginx Replica Set with two Pods generated.

Cleanup

Go to the Releases section

Delete the release of the replicaset-nginx-0.1.0 chart.

This will trigger the deletion of all items generated by the Chart.

results matching ""

    No results matching ""