Home Explore Blog Models CI



kubernetes

5th chunk of `content/en/docs/tutorials/stateless-application/guestbook.md`
1f31376fb700c760ea36f1f629e4ee9871bba049b75f34b60000000100000de0
1. Copy the external IP address, and load the page in your browser to view your guestbook.

{{< note >}}
Try adding some guestbook entries by typing in a message, and clicking Submit.
The message you typed appears in the frontend. This message indicates that
data is successfully added to Redis through the Services you created earlier.
{{< /note >}}

## Scale the Web Frontend

You can scale up or down as needed because your servers are defined as a
Service that uses a Deployment controller.

1. Run the following command to scale up the number of frontend Pods:

   ```shell
   kubectl scale deployment frontend --replicas=5
   ```

1. Query the list of Pods to verify the number of frontend Pods running:

   ```shell
   kubectl get pods
   ```

   The response should look similar to this:

   ```
   NAME                             READY   STATUS    RESTARTS   AGE
   frontend-85595f5bf9-5df5m        1/1     Running   0          83s
   frontend-85595f5bf9-7zmg5        1/1     Running   0          83s
   frontend-85595f5bf9-cpskg        1/1     Running   0          15m
   frontend-85595f5bf9-l2l54        1/1     Running   0          14m
   frontend-85595f5bf9-l9c8z        1/1     Running   0          14m
   redis-follower-dddfbdcc9-82sfr   1/1     Running   0          97m
   redis-follower-dddfbdcc9-qrt5k   1/1     Running   0          97m
   redis-leader-fb76b4755-xjr2n     1/1     Running   0          108m
   ```

1. Run the following command to scale down the number of frontend Pods:

   ```shell
   kubectl scale deployment frontend --replicas=2
   ```

1. Query the list of Pods to verify the number of frontend Pods running:

   ```shell
   kubectl get pods
   ```

   The response should look similar to this:

   ```
   NAME                             READY   STATUS    RESTARTS   AGE
   frontend-85595f5bf9-cpskg        1/1     Running   0          16m
   frontend-85595f5bf9-l9c8z        1/1     Running   0          15m
   redis-follower-dddfbdcc9-82sfr   1/1     Running   0          98m
   redis-follower-dddfbdcc9-qrt5k   1/1     Running   0          98m
   redis-leader-fb76b4755-xjr2n     1/1     Running   0          109m
   ```

## {{% heading "cleanup" %}}

Deleting the Deployments and Services also deletes any running Pods. Use
labels to delete multiple resources with one command.

1. Run the following commands to delete all Pods, Deployments, and Services.

   ```shell
   kubectl delete deployment -l app=redis
   kubectl delete service -l app=redis
   kubectl delete deployment frontend
   kubectl delete service frontend
   ```

   The response should look similar to this:

   ```
   deployment.apps "redis-follower" deleted
   deployment.apps "redis-leader" deleted
   deployment.apps "frontend" deleted
   service "frontend" deleted
   ```

1. Query the list of Pods to verify that no Pods are running:

   ```shell
   kubectl get pods
   ```

   The response should look similar to this:

   ```
   No resources found in default namespace.
   ```

## {{% heading "whatsnext" %}}

* Complete the [Kubernetes Basics](/docs/tutorials/kubernetes-basics/) Interactive Tutorials
* Use Kubernetes to create a blog using [Persistent Volumes for MySQL and Wordpress](/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/#visit-your-new-wordpress-blog)
* Read more about [connecting applications with services](/docs/tutorials/services/connect-applications-service/)
* Read more about [using labels effectively](/docs/concepts/overview/working-with-objects/labels/#using-labels-effectively)


Title: Scaling the Web Frontend and Cleanup
Summary
This section continues the previous instructions and shows how to scale down the number of frontend Pods using `kubectl scale`. Then, it guides the user through cleaning up the deployment by deleting all the Pods, Deployments, and Services related to the Guestbook application using `kubectl delete` with label selectors. Finally, it provides suggestions for further exploration of Kubernetes topics.