Container Architectures Flashcards

Dockers, Kubernetes, Anthos

1
Q

What are the technical benefits of containerisation?

A

1) Portability - Applications / services easily transport between different servers and environments.
2) Less Resources - Efficiency through using far fewer resources than VMs as your are only virtualising the OS rather than the entire infra.
3) DevOps – Bridges the environment and dependency logic between development and production.
4) Teams can create functionality with its own life cycle and scaling policies.
5) Security - Improved security by isolating applications from the host system and from each other.
6) Faster - Faster app start-up and easier scaling.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the business benefits of containerisation?

A

1) Consistency leading to lower cost of development via reduced overhead between development and operation.
2) Loose coupling, avoiding legacy and vendor lock-in
3) Agility

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you list all docker images?

A

docker images

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How would you go about deleting an old docker image?

A

docker rmi {image_name}

docker image rm {image_name}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How would you go about running a container from a local docker image in detached mode?

A

docker run -d {image_name : image_tag}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How would you go listing all running containers on docker?

A

docker ps

container ls

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How would you list docker containers even in exited state?

A

docker ps -a

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How would you go about mapping your dockerhost port to the container port when spinning up a container?

A

Docker run -d -p {dockerhost_portnumber}:{container_portnumber} {image_name}:{tag_id}

For example:
Docker run -d -p 8080:80 nginx:latest

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How would you go about mapping multiple ports on the host when spinning up a container?

A

Docker run -d -p {{dockerhost_portnumber}:{container_portnumber} -p {dockerhost_portnumber}:{container_portnumber} {image_name}:{tag_id}

For example:
Docker run -d -p 3000:80 -p 8080:80 nginx:latest

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How would you run a container in docker with a name?

A

Docker run –name {name} -d {image_name}:{tag_id}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the purpose of docker volumes?

A

Allows us to MOUNT data between:

1) Host and container
2) Between multiple containers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What command flag would you use to mount files between host and container in docker?

A

-v {host_destination} :{ conatiner_destination}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How would you go about running commands within a active container in docker?

A

docker exec -it { container_name } bash

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do you exit the CLI of a “stepped into” container?

A

ctrl + d

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What flag would you use to mount files between two containers in docker?

A

docker run –volumes-from { target_container_name }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How would you go about building a docker image from a local dockerfile named “website”?

A

docker build -t website:latest .

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Are docker volumes better in dev or prod and why?

A

Development, for connecting local file system to container file system.

This is not as required prod, as you can use the dockerfile to move files between host and container.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What’s the difference between CMD and RUN within a dockerfile?

A

RUN is an image build step, the state of the container after a RUN command will be committed to the container image. A Dockerfile can have many RUN steps that layer on top of one another to build the image.

CMD is the command the container executes by default when you launch the built image. A Dockerfile will only use the final CMD defined.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

How would you go about taking advantage of caching within docker builds?

A

Integrated the ADD and COPY commands into the Dockerfile.

The ADD and COPY commands in a Dockerfile allow you to import external files into a Docker image.

If the contents of all external files on the first ADD command are the same, the layer cache will be used and all subsequent commands until the next ADD or COPY command will use the layer cache.

However, if the contents of one or more external files are different, then all subsequent commands will be executed without using the layer cache.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

If you would like to reduce the size or resource efficiency of a single container, how would you go about it?

A

Use an alpine distribution of the container to reduce the image size.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

How would you go about tagging a existing docker image to give a version number?

A

docker tag website:latest website:1.0.0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Where does the word Kubernetes come from?

A

Greek for “Captain”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Why was Kubernetes invented by Google?

A

The rise of microservices caused an increased usage of container technologies, because containers offer the perfect host for small, independent and decoupled applications and servcies.

The rise of loosely coupled services resulted in the creation of applications that comprise of 100’s or even 1000’s of containers. Managing this number of containers across multiple environments using just scripts and self-made tools became more complex than managing a monolith.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What benefits does container orchestration offer?

A

High availability

Automation - Automates deployment, scaling, load balancing, logging and monitoring of containers.

Self-Healing - Automatically replaces unhealthy or failed conatiners.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What is a pod and why is it a kubernetes concept?

A

A running environment for a container.

The reason kubernetes abstracts pods as a layer ontop of the container is to give the engineers choice over which container runtime environment is used.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

What does it mean when we claim that pods in kubernetes are ephemeral?

A

The last for a very short length of time. They are not infinite.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

What happens when a pod goes down on a node in kubernetes?

A

A new pod will get created in its place, and the new pod will get assigned it’s own new IP address on re-creation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

What is a service within kubernetes and why is it used?

A

A static/permanent IP address that can be assigned to each pod.

Services are used to disconnect lifecycles of pods from services, meaning that services are still discoverable even if pods go down and their IP addresses change.

They can also be used to share services between different replicas of the same application running on different nodes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

What is a ingress within a Kubernetes node and why is it used?

A

Think of it as a service for services!

An ingress is an API object that manages external inbound connections to a set of existing services within a cluster, typically HTTP.

Ingress can be used for load balancing, SSL certificates and name-based virtual hosting (i.e. providing domain names to external services rather than IP addresses).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

Does your Kubernetes Cluster manage any data persistence?

A

No - You have to use volumes to persist data either within a kubernetes node itself or within a remote storage service.

If you do not use volumes, any data will be lost whenever a pod goes down and is recreated.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

What is a StatefulSet in kubernetes and why is it used?

A

StatefulSet is used to ensure data consistency between multiple database replicas. It does this by ensuring the database reads and writes are synchronised.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

How would you go about creating a deployment of a single pod with nginx running on it on kubernetes?

A

kubectl create deployment nginx –image=nginx

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

How would you go about logging activity on a pod?

A

kubectl logs pod_name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

How would you go about creating a kubernetes deployment from a yaml file?

A

kubectl apply -f config-file.yaml

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

How would you go about storing sensitive environmental variables in kubernetes?

A

You would store them on K8 itself rather than in any files being pushed to a repository, and you would accomplish this via creating a secret.

You create a secret by creating a new configuration file, setting “kind: Secret” and “type: Opaque” and then run the below command:

kubectl apply -f filename.yaml

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

What is the difference between a kubernetes secret and a kubernetes ConfigMap?

A

Secrets store data in base64 format meanwhile ConfigMaps store data in a plain text. So:

Use Secrets for things which are actually secret like API keys, credentials, etc

Use ConfigMaps for not-secret configuration data that needs to be shared among multiple components/services

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

What do you need to additionally specify on a service config file in order to create an external service?

A

type: LoadBalancer
nodePort: range from 30000 - 32767

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

What is the default service type on a kubernetes config file if you do not specify one?

A

clusterIP, also known as Internal Service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

What are the 3 primary things namespaces are used for in Kubernetes?

A

1) You can organise resources inside a virtual cluster within your cluster. These resources might be grouped by function, for example:

Database
Monitoring
Elastic Stack
Web Server Ingress

2) You can also use it to separate out teams to ensure nobody overwrites deployments with the same name. You can even assign access and resource limits for users within these name spaces for security and cost saving benefits.
3) You can use namespaces to serparate out Dev, Staging and Prod environments.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

How would you go about placing a domain name url on your kubernetes service?

A

Using an ingress.

You create one of these within a configuration.yaml file by specifying “kind: Ingress” and then write routing rules for forwarding requests to the internal service(s).

You will also need to install an Ingress Controller pod which will act as the entrypoint to the K8 cluster and will evaluate all the rules and manage redirections.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

What is Helm and what can it be used for?

A

Helm is a package manager for kubernetes.

It can be used for:

1) Download Helm Charts from public and private registries.
2) A templating engine for YAML configuration files.
3) Deploying the same application across development, staging and production environments.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

What is Helm Charts?

A

Package collections of YAML file and that are distributed via public and private registries.

For example, there can be a mongodb Helm Chart that contains all the necessary YAML files to setup express,, mongodb and any ingress config files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

How would you use Helm as a templating engine?

A

You would create a template YAML file with placeholders within appropriate value fields.

Then you would create a values.yaml file to specify the values used for that deployment.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

What is the need for volumes within Kubernetes?

A

To persist data by creating a data store that is not dependent upon pod lifecycles.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

How is persistent data storage achieved within kubernetes?

A

You use volumes to plug in an external database solution or file storage system into your K8 cluster.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

What is a headless service within Kubernetes?

A

Making requests directly to pods rather than going through a clusterIP address or loadbalancer.

This is useful for stateful database storage services as the pods do not necessarily all have the same read / write responsibiltiies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

What does Anthos use for logging and monitoring within hybrid-cloud environments?

A

Stackdriver

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q

What are nodes within Kubernetes?

A

Compute Engine instances (VMs) that house groups of pods.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

How would you go about creating a GKE instance in the GCP CLI?

A

gcloud container clusters create webfrontend –zone $MY_ZONE –num-nodes 2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q

How would you go about building a docker image within the GCP CLI?

A

gcloud builds submit -t gcr.io/$DEVSHELL_PROJECT_ID/{container_directory} {path_to_dockerfile}

The files are staged in Cloud Storage, and a Docker image is built and stored in the Container Registry.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

What is the difference between GKE standard and GKE autopilot?

A

GKE standard is configuration flexibility and pay-per-node.

GKE autopilot is a hands-off experience and pay-per-pod, making it more costly against those that configure GKE standard correctly.

52
Q

What are the steps to create a GKE deployment on GCP?

A

1) Enable the GKE and Container Registry API’s.
2) Create a standard GKE deployment in “Kubernetes Engine”. Ensure to tick “Allow full access to all Cloud API’s” within the Node Pool > Security > Access Scopes.
3) Click “Connect” from the GKE instance drop down and run the “gcloud container clusters get-credentials quiz-cluster –zone us-central1-b –project {project_id}” command within Cloud Shell.
4) Build your docker images from Dockerfiles using the “gcloud build” command, to upload the docker image to Cloud Registry.
5) Load the gcr addresses into the “image” key value pair of your Kubernetes deployment.yaml file.

53
Q

What is best practice when it comes to building docker images and shipping docker images?

A

It is best practice not to build your application in the very same container that you ship and run. Instead we employ a mutl-stage build process in which one container builds the image and a seperate container receives only what is actually needed to run the application.

This is important to keep build and run code clean and to remove an unnecessary additional attack surface from the in-production container.

54
Q

Why do Linux containers use union file systems?

A

To efficiently encapsulate applications and their dependencies into a set of clean, minimal layers.

55
Q

Why do containers traditionally write data to a external data service?

A

Because a containers topmost layer’s contents are lost when the conatiner is no longer runnning.

56
Q

When you use Kubernetes, you describe the desired state you want, and Kubernetes’s job is to make the deployed system conform to your desired state and to keep it there in spite of failures. What is the name for this management approach?

A

Declarative configuration

57
Q

What is a stateful application?

A

An application that requires data to be stored persistently

58
Q

What is the name for the computers in a Kubernetes cluster that can run your workloads?

A

Nodes

59
Q

Which control plane component is the cluster’s database?

A

etcd

60
Q

What is the role of the kubelet?

A

To serve as Kubernetes’s agent on each node

61
Q

Which control plane component is the only one with which clients interact directly?

A

kube-apiserver

62
Q

In GKE clusters, how are nodes stood up?

A

As Compute Engine virtual machines

63
Q

What is the purpose of configuring a regional cluster in GKE?

A

To allow applications running in the cluster to withstand the loss of a zone

64
Q

In a manifest file for a Pod, in which field do you define a container image for the Pod?

A

spec

65
Q

What is the purpose of the Deployment object within Kubernetes?

A

To ensure that a defined set of Pods is running at any given time.

66
Q

What are the three primary types of services within Kubernetes?

A

1) ClusterIP: Exposes the service on an IP address that is only accessible from within this cluster. This is the default type.
2) NodePort: Exposes the service on the IP address of each node in the cluster, simiarly to ClusterIP, but this time at a specific port number.
3) LoadBalancer: Exposes the service externally, using a load balancing service provided by a cloud provider.

67
Q

What’s the difference between a Deployment and a StatefulSet in kubernetes?

A

The Pods created through Deployment are not given persistent identities, however; by contrast, Pods created using StatefulSet have unique persistent identities with stable network identity and persistent disk storage.

68
Q

What is a DaemonSet in kubernetes?

A

DaemonSet ensures that a specific Pod or Pods are always running on all or some subset of nodes.

For example, you might use a DaemonSet to ensure that a logging agent is running on all nodes within the cluster.

69
Q

You want to deploy multiple copies of your application, so that you can load balance traffic across them. How should you deploy this application’s Pods to the production Namespace in your cluster?

A

Create a Deployment manifest that specifies the number of replicas that you want to run.

70
Q

You need to ensure that the production applications running on your Kubernetes cluster are not impacted by test and staging deployments. Which features should you implement and configure to ensure that the resources for your production applications can be prioritized?

A

Configure Namespaces for Test, Staging and Production and configure specific Kubernetes resource quotas for the test and staging Namespaces.

71
Q

You have deployed a new Kubernetes Engine regional cluster with four machines in the default pool for the first zone and left the number of zones at the default. How many Compute Engine machines are deployed and billed against your account?

A

Twelve. (Four nodes are deployed in each of three zones. A control plane node is deployed in each zone but it is not billed against your account.)

72
Q

Which Kubernetes component does the kubectl command connect to in order to carry out operations on a cluster?

A

kube-apiserver

73
Q

You have a new logging and auditing utility that you need to deploy on all of the nodes within your cluster. Which type of controller should you use to handle this task?

A

DaemonSet

74
Q

When configuring storage for stateful applications, what steps must you take to provide file system storage inside your containers for data from your applications that will not be lost or deleted if your Pods fail or are deleted for any reason?

A

1) Create a StateFul Set.
2) Create a Volume.
3) Create a volumeClaim.

75
Q

How are kubectl commands structured?

A

kubectl [COMMAND] [OBJECT] [NAME] [flags]

76
Q

Which control plane component does the kubectl command interact with?

A

kube-apiserver

77
Q

What is the most common reason for a Pod to report CrashLoopBackOff as its state?

A

The Pod’s configuration is not correct.

78
Q

You want to have two versions of your application in production, but be able to shift a small percentage of traffic to the newer version as a gradual test. This is an example of which deployment strategy?

A

Canary Deployment

79
Q

You want to have two versions of your application in production, but be able to switch all traffic between them. This is an example of which deployment strategy?

A

Blue-Green Deployment

80
Q

What does the “maxUnavailable” field indicate during a rolling update in Kubernetes?

A

The maximum number of pods that can be down at any given time across the old and new replicasets of a rolling update.

This number can either be absolute or a percentage.

81
Q

What does the “maxSurge” field indicate during a rolling update in Kubernetes?

A

The maximum number of pods that can be created concurrently in a new replicaset.

For example, if you set maxSurge to 2 then the new replicaset can only create 2 new pods at a time.

This number can either be absolute or a percentage.

82
Q

Describe the purpose of the Job Scheduler within Kubernetes?

A

The Job Scheduler will take jobs (finite tasks) and schedule these tasks on a pod and monitors the pod until the task is complete.

If a pod failure occurs, and the task is not completed, the Job Scheduler will schedule the task to run on a different pod on a different node until it is complete.

83
Q

What are CronJobs within Kubernetes?

A

Use cronjobs to schedule jobs to run periodically at fixed times, dates, or intervals.

84
Q

What is a job within Kubernetes?

A

A Kubernetes Job is a workload controller that represents a finite task. Jobs differ from other controller objects in that Jobs manage the task as it runs to completion, rather than managing an ongoing desired state (such as the total number of running Pods).

85
Q

True or false: if you manually decrease the size of a node pool, any Pods on deleted nodes will be restarted on other nodes.

A

False

86
Q

True or false: if autoscaling decreases the size of a node pool, any Pods on deleted nodes that aren’t managed by a replication controller will be lost.

A

False

87
Q

What is the definition of the word affinity (generalised, not for Kubernetes)?

A

The degree to which a substance tends to combine with another.

88
Q

What methods can you use to control pod placement in Kubernetes?

A

nodeSelector - For a pod to run on a specific node, that nodemust match all of the labels defined under the nodeSelector field within a pod configuration file.

Affinity and Anti-Affinity - Able to set soft preferences aswell as hard requirements on which node pods are deployed on. For example, ensuring it only deploys to nodes with GPU or TCU acceleration…or that it is preferred to be deployed with a pod of the same label.

89
Q

What is the difference between Affinity and Taints in Kubernetes?

A

Affinity is used to attract pods into the same node and / or zone based upon rulesets. Anti-affinity is used to repel pods from other pods in the same node and / or zone based upon rulesets.

By contrast you configure Taints on Nodes and the rules apply to all pods within the cluster.

90
Q

If a Taint ruleset is preventing you from scheduling a pod in any node, what can you do?

A

Apply a “Toleration” in the Pod to counteract the effect of a taint that would otherwise prevent the pod from being scheduled.

91
Q

What command do you use to create a service within Kubernetes?

A

kubectl expose

92
Q

How do you get a list of autoscale configurations in the command line?

A

kubectl get hpa

93
Q

You are configuring the rollout strategy for your Deployment that contains 8 Pods. You need to specify a Deployment property that will ensure at least 75% of the desired number of Pods is always running at the same time. What property and value should you set for the deployment to ensure that this is the case?

A

maxUnavailable=25%

94
Q

What status or event is used by the GKE autoscaler to decide when scaleout is required and a new node needs to be added?

A

When the scheduler cannot schedule a Pod due to resource constraints and the Pod has been marked as unschedulable.

95
Q

A parallel Kubernetes Job is configured with parallelism of property of 4 and a completion property of 9. How many Pods are kept in a running state by the Job controller immediately after the sixth successful completion?

A

3

96
Q

With a Kubernetes Job configured with a parallelism value of 3 and no completion count what happens to the status of the Job when one of the Pods successfully terminates?

A

The entire Job is considered complete and the remaining Pods are shut down.

97
Q

You have made a number of changes to your deployment and applied those changes. Which command should you use to rollback the environment to the deployment identified in the deployment history as revision 2?

1) Run ‘kubectl rollout undo deployment –to-revision=2’.
2) Run ‘kubectl apply -f DEPLOYMENT_FILE –to-revision=2’.
3) Run ‘kubectl rollout undo deployment ‘ twice.
4) Select the desired revision from the revision history list in the Google Cloud console.

A

1) Run ‘kubectl rollout undo deployment –to-revision=2’.

98
Q

When specifying Inter-pod affinity rules, you need to specify an affinity rule at the zone level, not at the individual Node level. Which additional parameter in the Pod manifest YAML must you set to apply this override?

1) label: failure-domain.beta.kubernetes.io/zone
2) zone: failure-domain.beta.kubernetes.io/zone
3) topologyKey: failure-domain.beta.kubernetes.io/zone
4) matchLabels: failure-domain.beta.kubernetes.io/zone

A

3) topologyKey: failure-domain.beta.kubernetes.io/zone

99
Q

After a Deployment has been created and its component Pods are running, which component is responsible for ensuring that a replacement Pod is launched whenever a Pod fails or is evicted?

A

ReplicaSet

100
Q

How do you configure a Kubernetes Job so that Pods are retained after completion?

1) Set an activeDeadlineSeconds value high enough to allow you to access the logs.
2) Configure the backofflimit parameter with a non-zero value.
3) Set a startingDeadlineSeconds value high enough to allow you to access the logs.
4) Configure the cascade flag for the Job with a value of false.

A

4) Configure the cascade flag for the Job with a value of false.

101
Q

You are configuring a Job to process the conversion of a sample of a large number of video files from one format to another. Which parameter should you configure to ensure that you stop processing once a sufficient quantity have been processed?

A

completions=n

102
Q

In GKE, what is the source of the IP addresses for Pods?

A

Address ranges assigned to your Virtual Private Cloud

103
Q

Which statement is true about Kubernetes networking?

1) Each Pod in a cluster has a unique IP address.
2) Each Pod in a node has a unique IP address, but IP addresses might be duplicated among nodes.
3) Each container in a cluster has a unique IP address.

A

1) Each pod in a cluster has a unique IP address

104
Q

What is the difference between a NodePort and a LoadBalancer service within Kubernetes?

A

NodePort is a simplified version of the LoadBalancer service, however you have toconfigure the Nodeport security walls and firewalls yourself.

LoadBalancer gives you the benefit of using the cloud provider’s load balancer service, bypassing all the configuration headache.

105
Q

What happens when you create an Ingress within GKE?

A

Exposes defined services via a single public IP address bound to HTTP load balancer.

106
Q

How does an Ingress resource decide how to route incoming requests?

A

By a combination of the host name and resource path requested.

107
Q

What is the purpose of enabling network policies in a Kubernetes cluster?

A

To restrict network access from a Pod to other Pods and Services inside the cluster.

108
Q

Describe the 3 most common types of Load Balancing in GKE, what resource they create within Google Cloud and their typical usage scenario?

A

1) ClusterIP Service - Sets up a GKE network - Used for internal applications and for clustering microservices.
2) LoadBalancer Service - Google Cloud Network Load Balancer (Regional) - Used for clustered microservices that need to communicate with external services to the cluster.
3) Ingress Object - Google Cloud HTTP(S) Load Balancer (Global) - Application front ends.

109
Q

What is the primary difference between Secrets and ConfigMaps?

A

Secrets are intended for use with security-sensitive data, such as private keys, while ConfigMaps are intended for use with general-purpose configuration information.

110
Q

How can a Pod request persistent storage without specifying the details of how that storage is to be implemented?

A

By using a PersistentVolumeClaim

111
Q

What happens if a Pod fails while it is using a persistent volume?

A

The volumes are unmounted from the failing Pod, and they continue to exist with their last contents.

112
Q

An application owner has created a Pod manifest using a PersistentVolumeClaim with a StorageClassName value of standard. What type of storage is used for this volume in a GKE Cluster?

A

Google Persistent Disk.

113
Q

A stateful set consists of four Pods that are named Demo-0, Demo-1, Demo-2 and Demo-3. The StatefulSet originally only had two replica Pods but this was recently increased to four replicas. An update is being rolled out to this StatefulSet using the RollingUpdate updateStrategy type. Which Pod will be the last member of the StatefulSet to be updated?

A

Demo-0

114
Q

A stateful set consists of four Pods that are named Demo-0, Demo-1, Demo-2 and Demo-3; with matching volumeClaims called Demo-0 to Demo-3 assigned by the StatefulSet. Demo-1 Pod has failed and the StatefulSet controller deploys a new Pod to replace it. What will the new Pod be called and what storage volume is attached to it?

A

The new Pod will be called Demo-1 and will have the existing Demo-1 volume attached to it.

115
Q

Which authentication method is enabled by default in GKE clusters of version 1.12 and later?

A

OpenID Connect

116
Q

What is the purpose of Kubernetes RBAC?

A

Offers control over kubernetes resources within the cluster supplementing the control provided directly by cloud IAM which allows you to control access at the gke and cluster level.

117
Q

True or false: Kubernetes RBAC offers both “allow” and “deny” rules.

A

Fasle.

In Kubernetes RBAC, there are no “deny” rules. If no rule grants a user a verb on a given resource, that user can’t do the action.

These arelisted within an array within the Role manifest file.

118
Q

Which statement is true about Kubernetes networking?

1) Each container in a cluster has a unique IP address.

2) Each Pod in a node has a unique IP address, but IP addresses might be duplicated among nodes.
check

3) Each Pod in a cluster has a unique IP address.

A

3) Each Pod in a cluster has a unique IP address.

Containers run on ports on that IP address.

119
Q

In GKE, what is the source of the IP addresses for Pods?

A

Address ranges assigned to your Virtual Private Cloud

120
Q

You want to implement account controls that will allow you to grant junior admin users the ability to view details about production clusters and applications, and to be able to fully manage test and lab resources inside your GKE cluster environments. Which account control mechanism will provide you with the level of granular control that is required for this type of user?

A

Kubernetes Roles Based Access Controls (RBAC)

121
Q

What is the role of Prometheus in a Kubernetes cluster?

A

To allow applications to expose application-specific metrics.

122
Q

What are the two types of probes in Kubernetes and how should they be used?

A

Liveness probe - Is the container running? If not, restart the container

Readiness probe - Is the container ready to accept requests? Is it still booting? Is it still processing the previous request?

123
Q

You are unable to find any logs in Cloud Logging for an issue with a Pod that occurred 2 months ago. You know that events were logged at the time for this issue. Why can you no longer find these logs?

A

They have been deleted by Cloud Logging as it only retains informaiton for 30 days.

If longer retention of logging is required, consider exporting to BigQuery.

124
Q

You have configured both a Readiness probe and Liveness probe for a critical application component. Shortly after the application has started, the Pod is running, but the Readiness probe is failing. What effect does this have on the application’s Pods and Services?

1) The Pod will be restarted continuously until the Readiness Probe succeeds.
2) Additional replica Pods are started until the Readiness Probe succeeds.
3) The Service will ignore the Pod until the Readiness Probe succeeds.
4) The Service is disabled until the Readiness Probe succeeds.

A

3) The Service will ignore the Pod until the Readiness Probe succeeds.

125
Q

You are troubleshooting an issue which happened in the last hour. You execute the command ‘kubectl logs –since=3h demo-pod’. However, the events you are looking for do not appear in the output. What is the likely cause?

A

The log file was greater than 100MB in size and it has been rotated.

126
Q

What are the steps you would take to use Google Cloud managed services from an application running in GKE?

A

1) Create a new service account
2) Give the service account a Cloud IAM role with least privilege
3) Store its credential in a Kubernetes secret
4) Use the credential in API calls to the service.

127
Q

You are configuring applications that need access to Google managed storage services. The applications will be deployed to your GKE clusters. How should you provide the credentials to the applications so that they are protected?

A

Create Kubernetes Secrets containing the account credential files and present those to the containers as environment variables or Secret Volumes.