Kubernetes Journey - Autoscaling, Config Map and Secrets | Scribe

    Kubernetes Journey - Autoscaling, Config Map and Secrets

    • Hafeez Baig |
    • 19 steps |
    • 2 minutes
    alert ordinal icon
    Please review the previous lab on How to Scale Deployments and Resizing before proceeding with this lab.<https://scribehow.com/shared/Kubernetes_Journey__Scaling_Deployments_and_Resizing_Node_Pools__onKkV9L1R4udnzIWAi1w5w>
    1
    On the **Kubernetes clusters** page, click on the Name **my-cluster**
    2
    **my-cluster** wizard will open, here you can view that the Cluster is now available and resized
    3
    Go back to the **Cloud Shell** tab
    4
    Type the command [[kubectl autoscale deployment hello-world-rest-api --max=4 --cpu-percent=70]]
    information ordinal icon
    **What is [[kubectl autoscale deployment hello-world-rest-api --max=4 --cpu-percent=70]]command?**\ \ The command `kubectl autoscale deployment hello-world-rest-api --max=4 --cpu-percent=70` sets up horizontal pod autoscaling for the `hello-world-rest-api` deployment. It configures the deployment to automatically scale the number of Pods based on CPU utilization, with a maximum of 4 Pods. The target CPU utilization is set to 70%, meaning the autoscaler will adjust the number of Pods to maintain an average CPU usage of 70%.
    5
    **hello-world-rest-api autoscaled** is displayed **Note:** This means the Cluster is now Autoscaled
    6
    To get the HPA, type the command [[kubectl get hpa]]
    information ordinal icon
    **What is** [[kubectl get hpa]]**command?**\ \ The command `kubectl get hpa` retrieves and displays information about the Horizontal Pod Autoscalers (HPA) in the Kubernetes cluster. It provides details such as the name of the HPA, the target deployment or service, current CPU utilization, target CPU utilization, and the number of desired and current replicas. This command helps monitor and manage the autoscaling configurations for your applications.
    7
    Information of the pod is displayed
    8
    Type the command [[kubectl create configmap hello-world-config --from-literal=RDS_DBNAME=todos]]
    information ordinal icon
    **What is** [[kubectl create configmap hello-world-config --from-literal=RDS_DBNAME=todos ]]**command?**\ \ The command `kubectl create configmap hello-world-config --from-literal=RDS_DBNAME=todos` creates a ConfigMap named `hello-world-config` with a literal key-value pair. In this case, the key is `RDS_DBNAME` and the value is `todos`. ConfigMaps are used to store configuration data in key-value pairs, which can be consumed by Pods in a Kubernetes cluster to configure applications without hardcoding the configuration into the application itself.
    9
    configigmap/hello-world-config created is displayed **Note:** This means the Configmap is created
    10
    To get the Configmap, type the command [[kubectl get configmap]]
    information ordinal icon
    **What is [[kubectl get configmap]] command?**\ \ The command `kubectl get configmap` retrieves and displays information about all the ConfigMaps in the Kubernetes cluster. It provides details such as the names of the ConfigMaps and their namespaces, helping you manage and inspect the configuration data stored within the cluster.
    11
    Information of the configmap is displayed
    12
    Type the command [[kubectl describe configmap hello-world-config]]
    information ordinal icon
    **What is** [[kubectl describe configmap hello-world-config ]]**command?**\ \ The command `kubectl describe configmap hello-world-config` provides detailed information about the ConfigMap named `hello-world-config`. It displays the configuration data stored within the ConfigMap, including key-value pairs, as well as metadata such as creation timestamps and labels. This command is useful for inspecting and troubleshooting the contents and configuration of a specific ConfigMap in the Kubernetes cluster.
    13
    Information of the **configmap hello-world-config** is displayed
    14
    Type the command [[kubectl create secret generic hello-world-secrets-1 --from-literal=RDS_PASSWORD=dummytodos]]