concept STS Deployment in category microservice

This is an excerpt from Manning's book Microservices Security in Action.
Listing 11.9 modifies the STS Deployment to load keystore.jks and jwt.jks files from a Git repository by using an init container instead of loading them from a ConfigMap object (as in listing 11.8). You can find the complete updated definition of the Kubernetes Deployment in the chapter11/sample01/sts.deployment.with.initcontainer.yaml file. The following listing shows part of the updated STS deployment, corresponding to the init container.
In this section, we create a service account called
ecomm, and update the STS Deployment to use it. We want all the Pods running under the STS Deployment to run under theecommservice account. Let’s use the followingkubectlcommand to create theecommservice account:\> kubectl create serviceaccount ecomm serviceaccount/ecomm createdAt the time of creating the service account, Kubernetes also creates a token secret and attaches it to the service account. When we update the STS Deployment to run under the
ecommservice account, all the Pods under the STS Deployment can use this token secret (which is a JWT) to authenticate to the API server. The following command shows the details of theecommservice account in YAML format:\> kubectl get serviceaccount ecomm -o yaml apiVersion: v1 kind: ServiceAccount metadata: name: ecomm namespace: default secrets: - name: ecomm-token-92p7gNow let’s set the
ecommservice account for the STS Deployment. The complete up-dated definition of the STS Deployment is in the chapter11/sample01/sts.deployment .with.service.account.yaml file. We are introducing these new changes on top of the STS Deployment created in section 11.3.2. As shown in the following listing, the only change was to add theserviceAccountNameelement under thespecelement (corresponding to the Pod) of the Deployment.