Skip to content

Commit 18e69a2

Browse files
author
abregman
committed
Add a couple of questions
On various topics such as Containers, GitHub Actions, Azure and more. Enjoy :)
1 parent a074e5b commit 18e69a2

File tree

3 files changed

+289
-26
lines changed

3 files changed

+289
-26
lines changed

README.md

+227-26
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
:information_source:  This repo contains questions and exercises on various technical topics, sometimes related to DevOps and SRE :)
44

5-
:bar_chart:  There are currently **1840** questions
5+
:bar_chart:  There are currently **1899** questions
66

77
:books:  To learn more about DevOps and SRE, check the resources in [devops-resources](https://github.com/bregman-arie/devops-resources) repository
88

@@ -785,7 +785,24 @@ For example, you might configure the workflow to trigger every time a changed is
785785
</b></details>
786786

787787
<details>
788-
<summary>In Git</summary><br><b>
788+
<summary>True or False? In Github Actions, jobs are executed in parallel by deafult</summary><br><b>
789+
790+
True
791+
</b></details>
792+
793+
<details>
794+
<summary>How to create dependencies between jobs so one job runs after another?</summary><br><b>
795+
796+
Using the "needs" attribute/directive.
797+
798+
```
799+
jobs:
800+
job1:
801+
job2:
802+
needs: job1
803+
```
804+
805+
In the above example, job1 must complete successfully before job2 runs
789806
</b></details>
790807

791808
<details>
@@ -900,6 +917,16 @@ Read more about auto scaling [here](https://aws.amazon.com/autoscaling)
900917
False. Auto scaling adjusts capacity and this can mean removing some resources based on usage and performances.
901918
</b></details>
902919

920+
#### Cloud - Security
921+
922+
<details>
923+
<summary>How to secure instances in the cloud?</summary><br><b>
924+
925+
* Instance should have minimal permissions needed. You don't want an instance-level incident to become an account-level incident
926+
* Instances should be accessed through load balancers or bastion hosts. In other words, they should be off the internet (in a private subnet behind a NAT).
927+
* Using latest OS images with your instances (or at least apply latest patches)
928+
</b></details>
929+
903930
## AWS
904931

905932
### AWS Exercises
@@ -1433,6 +1460,14 @@ Learn more about it [here](https://aws.amazon.com/compliance/shared-responsibili
14331460
<summary>What is the AWS compliance program?</summary><br><b>
14341461
</b></details>
14351462

1463+
<details>
1464+
<summary>How to secure instances in AWS?</summary><br><b>
1465+
1466+
* Instance IAM roles should have minimal permissions needed. You don't want an instance-level incident to become an account-level incident
1467+
* Use "AWS System Manager Session Manager" for SSH
1468+
* Using latest OS images with your instances
1469+
</b></details>
1470+
14361471
<details>
14371472
<summary>What is AWS Artifact?</summary><br><b>
14381473

@@ -5948,7 +5983,7 @@ True
59485983
</b></details>
59495984

59505985
<details>
5951-
<summary>Using the 'latest' tag when pulling an image means, you are pulling the most recently published image</summary><br><b>
5986+
<summary>True or False? Using the 'latest' tag when pulling an image means, you are pulling the most recently published image</summary><br><b>
59525987

59535988
False. While this might be true in some cases, it's not guaranteed that you'll pull the latest published image when using the 'latest' tag.<br>
59545989
For example, in some images, 'edge' tag is used for the most recently published images.
@@ -6076,6 +6111,20 @@ Look for "Cmd" or "Entrypoint" fields in the output of `docker image inspec <ima
60766111
5. Repeat for every instruction
60776112
</b></details>
60786113

6114+
<details>
6115+
<summary>What is the role of cache in image builds?</summary><br><b>
6116+
6117+
When you build an image for the first time, the different layers are being cached. So, while the first build of the image might take time, any other build of the same image (given that Dockerfile didn't change or the content used by the instructions) will be instant thanks to the caching mechanism used.
6118+
6119+
In little bit more details, it works this way:
6120+
1. The first instruction (FROM) will check if base image already exists on the host before pulling it
6121+
2. For the next instruction, it will check in the build cache if an existing layer was built from the same base image + if it used the same instruction
6122+
1. If it finds such layer, it skips the instruction and links the existing layer and it keeps using the cache.
6123+
2. If it doesn't find a matching layer, it builds the layer and the cache is invalidated.
6124+
6125+
Note: in some cases (like COPY and ADD instructions) the instruction might stay the same but if the content of what being copied is changed then the cache is invalidated. The way this check is done is by comparing the checksum of each file that is being copied.
6126+
</b></details>
6127+
60796128
<details>
60806129
<summary>What ways are there to reduce container images size?</summary><br><b>
60816130

@@ -6085,6 +6134,17 @@ Look for "Cmd" or "Entrypoint" fields in the output of `docker image inspec <ima
60856134
* For Docker images, you can use multi-stage builds
60866135
</b></details>
60876136

6137+
<details>
6138+
<summary>What are the pros and cons of squashing images?</summary><br><b>
6139+
6140+
Pros:
6141+
* Smaller image
6142+
* Reducing number of layers (especially if the image has lot of layers)
6143+
Cons:
6144+
* No sharing of the image layers
6145+
* Push and pull can take more time (because no matching layers found on target)
6146+
</b></details>
6147+
60886148
#### Containers - Volume
60896149

60906150
<details>
@@ -6102,7 +6162,7 @@ Different container engines (e.g. Docker, Podman) can build images automatically
61026162
</b></details>
61036163

61046164
<details>
6105-
<summary>What is the first line in all Dockefiles and what does it mean?</summary><br><b>
6165+
<summary>What is the instruction in all Dockefiles and what does it mean?</summary><br><b>
61066166

61076167
The first instruction is `FROM <image name>`<br>
61086168
It specifies the base layer of the image to be used. Every other instruction is a layer on top of that base image.
@@ -6126,6 +6186,13 @@ It specifies the base layer of the image to be used. Every other instruction is
61266186
* Do not use environment variables to share secrets
61276187
* Use images from official repositories
61286188
* Keep images small! - you want them only to include what is required for the application to run successfully. Nothing else.
6189+
* If are using the apt package manager, you might use 'no-install-recommends' with `apt-get install` to install only main dependencies (instead of suggested, recommended packages)
6190+
</b></details>
6191+
6192+
<details>
6193+
<summary>What is the "build context"?</summary><br><b>
6194+
6195+
[Docker docs](https://docs.docker.com/engine/reference/commandline/build): "A build’s context is the set of files located in the specified PATH or URL"
61296196
</b></details>
61306197

61316198
<details>
@@ -6365,21 +6432,6 @@ Create a new image from a container’s changes
63656432
Via the local socket at `/var/run/docker.sock`
63666433
</b></details>
63676434

6368-
<details>
6369-
<summary>Explain what is Docker compose and what is it used for</summary><br><b>
6370-
6371-
Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration.
6372-
6373-
For example, you can use it to set up ELK stack where the services are: elasticsearch, logstash and kibana. Each running in its own container.
6374-
</b></details>
6375-
6376-
<details>
6377-
<summary>Describe the process of using Docker Compose</summary><br><br>
6378-
6379-
* Define the services you would like to run together in a docker-compose.yml file
6380-
* Run `docker-compose up` to run the services
6381-
</b></details>
6382-
63836435
<details>
63846436
<summary>Explain Docker interlock</summary><br><b>
63856437
</b></details>
@@ -6413,6 +6465,24 @@ Because each container has its own writable container layer, and all changes are
64136465
<summary>How do you copy files from Docker container to the host and vice versa?</summary><br><b>
64146466
</b></details>
64156467

6468+
#### Containers - Docker Compose
6469+
6470+
<details>
6471+
<summary>Explain what is Docker compose and what is it used for</summary><br><b>
6472+
6473+
Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration.
6474+
6475+
For example, you can use it to set up ELK stack where the services are: elasticsearch, logstash and kibana. Each running in its own container.<br>
6476+
In general, it's useful for running applications which composed out of several different services. It let's you manage it as one deployed app, instead of different multiple separate services.
6477+
</b></details>
6478+
6479+
<details>
6480+
<summary>Describe the process of using Docker Compose</summary><br><br>
6481+
6482+
* Define the services you would like to run together in a docker-compose.yml file
6483+
* Run `docker-compose up` to run the services
6484+
</b></details>
6485+
64166486
#### Containers - Docker Images
64176487

64186488
<details>
@@ -6469,10 +6539,52 @@ By default, Docker uses everything (all the files and directories) in the direct
64696539
`.dockerignore` used for excluding files and directories from the build context
64706540
</b></details>
64716541

6542+
#### Containers - Networking
6543+
6544+
<details>
6545+
<summary>What container network standards or architectures are you familiar with?</summary><br><b>
6546+
6547+
CNM (Container Network Model):
6548+
* Requires distrubited key value store (like etcd for example) for storing the network configuration
6549+
* Used by Docker
6550+
CNI (Container Network Interface):
6551+
* Network configuration should be in JSON format
6552+
</b></details>
6553+
6554+
#### Containers - Docker Networking
6555+
6556+
<details>
6557+
<summary>What network specification Docker is using and how its implementation is called?</summary><br><b>
6558+
6559+
Docker is using the CNM (Container Network Model) design specification.<br>
6560+
The implementation of CNM specification by Docker is called "libnetwork". It's written in Go.
6561+
</b></details>
6562+
6563+
<details>
6564+
<summary>Explain the following blocks in regards to CNM:
6565+
6566+
* Networks
6567+
* Endpoints
6568+
* Sandboxes</summary><br><b>
6569+
6570+
* Networks: software implementation of an switch. They used for grouping and isolating a collection of endpoints.
6571+
* Endpoints: Virtual network interfaces. Used for making connections.
6572+
* Sandboxes: Isolated network stack (interfaces, routing tables, ports, ...)
6573+
</b></details>
6574+
64726575
#### Containers - Security
64736576

64746577
<details>
6475-
<summary>A container can cause a kernel panic and bring down the whole host. What preventive actions can you apply to avoid it?</summary><br><b>
6578+
<summary>What security best practices are there regarding containers?</summary><br><b>
6579+
* Install only the necessary packages in the container
6580+
* Don't run containers as root when possible
6581+
* Don't mount the Docker daemon unix socket into any of the containers
6582+
* Set volumes and container's filesystem to read only
6583+
* DO NOT run containers with `--privilged` flag
6584+
</b></details>
6585+
6586+
<details>
6587+
<summary>A container can cause a kernel panic and bring down the whole host. What preventive actions can you apply to avoid this specific situation?</summary><br><b>
64766588

64776589
* Install only the necessary packages in the container
64786590
* Set volumes and container's filesystem to read only
@@ -8382,6 +8494,20 @@ Or directly on the command line: `helm install --set some_key=some_value`
83828494
Helm allows you to upgrade, remove and rollback to previous versions of charts. In version 2 of Helm it was with what is known as "Tiller". In version 3, it was removed due to security concerns.
83838495
</b></details>
83848496

8497+
#### Kubernetes - Security
8498+
8499+
<details>
8500+
<summary>What best practices do you follow in regards to the Kubernetes cluster?</summary><br><b>
8501+
8502+
* Secure inter-service communication (one way is to use Istio to provide mutual TLS)
8503+
* Isolate different resources into separate namespaces based on some logical groups
8504+
* Use supported container runtime (if you use Docker then drop it because it's deprecated. You might want to CRI-O as an engine and podman for CLI)
8505+
* Test properly changes to the cluster (e.g. consider using Datree to prevent kubernetes misconfigurations)
8506+
* Limit who can do what (by using for example OPA gatekeeper) in the cluster
8507+
* Use NetworkPolicy to apply network security
8508+
* Consider using tools (e.g. Falco) for monitoring threats
8509+
</b></details>
8510+
83858511
#### Submariner
83868512

83878513
<details>
@@ -11673,6 +11799,10 @@ Running parallel and high-performance computing applications
1167311799

1167411800
#### Azure - Network
1167511801

11802+
<details>
11803+
<summary>What Azure network services are you familiar with?</summary><br><b>
11804+
</b></details>
11805+
1167611806
<details>
1167711807
<summary>What's an Azure region?</summary><br><b>
1167811808
</b></details>
@@ -11683,6 +11813,10 @@ Running parallel and high-performance computing applications
1168311813

1168411814
#### Azure Storage
1168511815

11816+
<details>
11817+
<summary>What Azure storage services are you familiar with?</summary><br><b>
11818+
</b></details>
11819+
1168611820
<details>
1168711821
<summary>What storage options Azure supports?</summary><br><b>
1168811822
</b></details>
@@ -13337,18 +13471,14 @@ It's an architecture in which data is and retrieved from a single, non-shared, s
1333713471
* Browser cache
1333813472
* Operating system cache
1333913473
* The DNS server configured on the user's system (can be ISP DNS, public DNS, ...)
13340-
1334113474
2. If it couldn't find a DNS record locally, a full DNS resolution is started.
13342-
1334313475
3. It connects to the server using the TCP protocol
13344-
1334513476
4. The browser sends an HTTP request to the server
13346-
1334713477
5. The server sends an HTTP response back to the browser
13348-
1334913478
6. The browser renders the response (e.g. HTML)
13350-
1335113479
7. The browser then sends subsequent requests as needed to the server to get the embedded links, javascript, images in the HTML and then steps 3 to 5 are repeated.
13480+
13481+
TODO: add more details!
1335213482
</b></details>
1335313483

1335413484
#### API
@@ -13396,6 +13526,18 @@ While automation focuses on a task level, Orchestration is the process of automa
1339613526
<summary>What is a Debuggger and how it works?</summary><br><b>
1339713527
</b></details>
1339813528

13529+
<details>
13530+
<summary>What services an application might have?</summary><br><b>
13531+
13532+
* Authorization
13533+
* Logging
13534+
* Authentication
13535+
* Ordering
13536+
* Front-end
13537+
* Back-end
13538+
...
13539+
</b></details>
13540+
1339913541
<details>
1340013542
<summary>What is Metadata?</summary><br><b>
1340113543

@@ -14054,6 +14196,18 @@ Not only this will tell you what is expected from you, it will also provide big
1405414196

1405514197
## Databases
1405614198

14199+
|Name|Topic|Objective & Instructions|Solution|Comments|
14200+
|--------|--------|------|----|----|
14201+
| Message Board Tables | Relational DB Tables | [Exercise](exercises/databases/table_for_message_board_system.md) | [Solution](exercises/databases/solutions/table_for_message_board_system.md)
14202+
14203+
<details>
14204+
<summary>What is a relational database?</summary><br><b>
14205+
14206+
* Data Storage: system to store data in tables
14207+
* SQL: programming language to manage relational databases
14208+
* Data Definition Language: a standard syntax to create, alter and delete tables
14209+
</b></details>
14210+
1405714211
<details>
1405814212
<summary>What does it mean when a database is ACID compliant?</summary><br>
1405914213

@@ -14151,6 +14305,53 @@ A connection leak is a situation where database connection isn't closed after be
1415114305
A database index is a data structure that improves the speed of operations in a table. Indexes can be created using one or more columns, providing the basis for both rapid random lookups and efficient ordering of access to records.
1415214306
</b></details>
1415314307

14308+
<details>
14309+
<summary>What data types are there in relational databases?</summary><br><b>
14310+
</b></details>
14311+
14312+
<details>
14313+
<summary>Explain Normalization</summary><br><b>
14314+
14315+
Data that is used multiple times in a database should be stored once and referenced with a foreign key.<br>
14316+
This has the clear benefit of ease of maintenance where you need to change a value only in a single place to change it everywhere.
14317+
</b></details>
14318+
14319+
<details>
14320+
<summary>Explain Primary Key and Foreign Key</summary><br><b>
14321+
14322+
Primary Key: each row in every table should a unique identifier that represents the row.<br>
14323+
Foreign Key: a reference to another table's primary key. This allows you to join table together to retrieve all the information you need without duplicating data.
14324+
</b></details>
14325+
14326+
<details>
14327+
<summary>What types of data tables have you used?</summary><br><b>
14328+
14329+
* Primary data table: main data you care about
14330+
* Details table: includes a foreign key and has one to many relationship
14331+
* Lookup values table: can be one table per lookup or a table containing all the lookups and has one to many relationship
14332+
* Multi reference table
14333+
</b></details>
14334+
14335+
<details>
14336+
<summary>What is ORM? What benefits it provides in regards to relational databases usage?</summary><br><b>
14337+
14338+
[Wikipedia](https://en.wikipedia.org/wiki/Object%E2%80%93relational_mapping): "is a programming technique for converting data between incompatible type systems using object-oriented programming languages"
14339+
14340+
In regards to the relational databases:
14341+
14342+
* Database as code
14343+
* Database abstraction
14344+
* Encapsulates SQL complexity
14345+
* Enables code review process
14346+
* Enables usage as a native OOP structure
14347+
</b></details>
14348+
14349+
<details>
14350+
<summary>What is DDL?</summary><br><b>
14351+
14352+
[Wikipedia](https://en.wikipedia.org/wiki/Data_definition_language): "In the context of SQL, data definition or data description language (DDL) is a syntax for creating and modifying database objects such as tables, indices, and users."
14353+
</b></details>
14354+
1415414355
## Regex
1415514356

1415614357
Given a text file, perform the following exercises

0 commit comments

Comments
 (0)