You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+227-26
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
:information_source: This repo contains questions and exercises on various technical topics, sometimes related to DevOps and SRE :)
4
4
5
-
:bar_chart: There are currently **1840** questions
5
+
:bar_chart: There are currently **1899** questions
6
6
7
7
:books: To learn more about DevOps and SRE, check the resources in [devops-resources](https://github.com/bregman-arie/devops-resources) repository
8
8
@@ -785,7 +785,24 @@ For example, you might configure the workflow to trigger every time a changed is
785
785
</b></details>
786
786
787
787
<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
789
806
</b></details>
790
807
791
808
<details>
@@ -900,6 +917,16 @@ Read more about auto scaling [here](https://aws.amazon.com/autoscaling)
900
917
False. Auto scaling adjusts capacity and this can mean removing some resources based on usage and performances.
901
918
</b></details>
902
919
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
+
903
930
## AWS
904
931
905
932
### AWS Exercises
@@ -1433,6 +1460,14 @@ Learn more about it [here](https://aws.amazon.com/compliance/shared-responsibili
1433
1460
<summary>What is the AWS compliance program?</summary><br><b>
1434
1461
</b></details>
1435
1462
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
+
1436
1471
<details>
1437
1472
<summary>What is AWS Artifact?</summary><br><b>
1438
1473
@@ -5948,7 +5983,7 @@ True
5948
5983
</b></details>
5949
5984
5950
5985
<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>
5952
5987
5953
5988
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>
5954
5989
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
6076
6111
5. Repeat for every instruction
6077
6112
</b></details>
6078
6113
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
+
6079
6128
<details>
6080
6129
<summary>What ways are there to reduce container images size?</summary><br><b>
6081
6130
@@ -6085,6 +6134,17 @@ Look for "Cmd" or "Entrypoint" fields in the output of `docker image inspec <ima
6085
6134
* For Docker images, you can use multi-stage builds
6086
6135
</b></details>
6087
6136
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
+
6088
6148
#### Containers - Volume
6089
6149
6090
6150
<details>
@@ -6102,7 +6162,7 @@ Different container engines (e.g. Docker, Podman) can build images automatically
6102
6162
</b></details>
6103
6163
6104
6164
<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>
6106
6166
6107
6167
The first instruction is `FROM <image name>`<br>
6108
6168
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
6126
6186
* Do not use environment variables to share secrets
6127
6187
* Use images from official repositories
6128
6188
* 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"
6129
6196
</b></details>
6130
6197
6131
6198
<details>
@@ -6365,21 +6432,6 @@ Create a new image from a container’s changes
6365
6432
Via the local socket at `/var/run/docker.sock`
6366
6433
</b></details>
6367
6434
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
@@ -6413,6 +6465,24 @@ Because each container has its own writable container layer, and all changes are
6413
6465
<summary>How do you copy files from Docker container to the host and vice versa?</summary><br><b>
6414
6466
</b></details>
6415
6467
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
+
6416
6486
#### Containers - Docker Images
6417
6487
6418
6488
<details>
@@ -6469,10 +6539,52 @@ By default, Docker uses everything (all the files and directories) in the direct
6469
6539
`.dockerignore` used for excluding files and directories from the build context
6470
6540
</b></details>
6471
6541
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.
<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>
6476
6588
6477
6589
* Install only the necessary packages in the container
6478
6590
* 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`
8382
8494
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.
8383
8495
</b></details>
8384
8496
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
+
8385
8511
#### Submariner
8386
8512
8387
8513
<details>
@@ -11673,6 +11799,10 @@ Running parallel and high-performance computing applications
11673
11799
11674
11800
#### Azure - Network
11675
11801
11802
+
<details>
11803
+
<summary>What Azure network services are you familiar with?</summary><br><b>
11804
+
</b></details>
11805
+
11676
11806
<details>
11677
11807
<summary>What's an Azure region?</summary><br><b>
11678
11808
</b></details>
@@ -11683,6 +11813,10 @@ Running parallel and high-performance computing applications
11683
11813
11684
11814
#### Azure Storage
11685
11815
11816
+
<details>
11817
+
<summary>What Azure storage services are you familiar with?</summary><br><b>
@@ -13337,18 +13471,14 @@ It's an architecture in which data is and retrieved from a single, non-shared, s
13337
13471
* Browser cache
13338
13472
* Operating system cache
13339
13473
* The DNS server configured on the user's system (can be ISP DNS, public DNS, ...)
13340
-
13341
13474
2. If it couldn't find a DNS record locally, a full DNS resolution is started.
13342
-
13343
13475
3. It connects to the server using the TCP protocol
13344
-
13345
13476
4. The browser sends an HTTP request to the server
13346
-
13347
13477
5. The server sends an HTTP response back to the browser
13348
-
13349
13478
6. The browser renders the response (e.g. HTML)
13350
-
13351
13479
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!
13352
13482
</b></details>
13353
13483
13354
13484
#### API
@@ -13396,6 +13526,18 @@ While automation focuses on a task level, Orchestration is the process of automa
13396
13526
<summary>What is a Debuggger and how it works?</summary><br><b>
13397
13527
</b></details>
13398
13528
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
+
13399
13541
<details>
13400
13542
<summary>What is Metadata?</summary><br><b>
13401
13543
@@ -14054,6 +14196,18 @@ Not only this will tell you what is expected from you, it will also provide big
<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
+
14057
14211
<details>
14058
14212
<summary>What does it mean when a database is ACID compliant?</summary><br>
14059
14213
@@ -14151,6 +14305,53 @@ A connection leak is a situation where database connection isn't closed after be
14151
14305
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.
14152
14306
</b></details>
14153
14307
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
+
14154
14355
## Regex
14155
14356
14156
14357
Given a text file, perform the following exercises
0 commit comments