Block vs Object vs File storage

FeatureObject StorageBlock StorageNetwork Storage
Data UnitObject (data + metadata)Block (raw data chunks)File (organized in paths)
Access MethodRestful APIsFC/iSCSINFS/SMB
Use CaseArchival, media storageDatabases, VMsShared file access
PerformanceHigh scalabilityHigh IOPS, low latencyModerate performance

what are root causes of deadlock?

4 conditions happen at the same time:

  • Mutual Exclusion
  • Hold and Wait
  • No Preemption (no process is able to force another process release resource)
  • Circular Wait

What is machine code

Code executed by CPU

machine code vs byte code

Machine codeByte code
instructions run by CPUcode run by virtual machine (JVM, V8)

What kind of file does Rust compile to?

Machine code

What tools are used to read instruction from binary file?

obj_dump & xxd CLI

How many types of instruction?

  1. Data Movement: move data between registers, memory, and I/O devices.
  2. Arithmetic: perform mathematical operations on data.
  3. Logical: perform logical operations on binary data.
  4. Control Flow: alter the sequence of execution in a program.
  5. Comparison: compare two operands and set condition flags based on the result.
  6. Shift and Rotate: perform bit-shifting or bit-rotation operations on data.
  7. Input/Output: handle communication between the processor and external devices or memory.
  8. Nop (No Operation) NOP: A no-operation instruction that does nothing. It is often used for timing, debugging, or alignment purposes.
  9. Exception and Interrupt: manage interrupt handling and exceptions.
  10. System Control: interact with the system or control the processor’s behavior.
  11. Floating Point: handle floating-point operations, which are important for calculations that involve real numbers.

Stack vs Heap vs Static memory

stackheapstatic memory
scopedownershipprogram duration
LIFOjumping from 1 pointer to anotherdata/BSS segment

what are the differences between &String and &str ?

FeatureString&str&String
OwnershipOwned, heap-allocatedBorrowed, immutableBorrowed reference
MutabilityMutableImmutableImmutable
MemoryHeapStack or HeapHeap
ConversionCan be borrowed as &strCan be converted to StringAutomatically coerces to &str
Typical UseOwned, growable stringImmutable view of dataImmutable borrowed view

How does Scheduler create a Pod?

  • Scheduler does not create a Pod
  • Scheduler scores node (affinity, taint, toleration, …) -> notify API server -> ETCD
  • Kubelet get info from API server-> create container

How a new pod is created in Kubernetes cluster?

pod-creation

how it score nodes???

manage platform service (operation) là làm những gì???

  • installation
  • incident management
  • downtime management
  • update & patching
  • observability
  • config management
  • performance optimization
    • optimize system components
    • reduce bottle neck
  • backup & recovery
  • Hardening
  • Cost optimization

Does downtime happen when an incident occur?

scheduled downtime

term dung de tranh downtime incident? plan han che code + ops ngu

What is Hardening? vs Computer Security???

  1. Secure Coding ??
    1. scan code for sensitive content
    2. scan dependencies
  2. enforce Authn and Authz
  3. data encryption

what can Kong do?

API Gateway Ingress Controller

What API Gateway can do? giai quyet van de gi???

  1. centralizes API requests
  2. applies policies
  3. manages routing

What the differences between ingress, egress and api gateway?

FeatureIngressEgressAPI Gateway
Primary FocusManaging incoming traffic to services.Managing outgoing traffic to external systems.Managing API traffic (both ingress & egress).
ScopeNetwork-level HTTP/HTTPS traffic.Network-level outbound traffic.Application-level API requests and responses.
Key FunctionalityRouting, SSL termination, load balancing.Traffic control, security, monitoring.Authentication, rate limiting, monitoring, routing.
Use CaseExposing services to external clients.Restricting or monitoring outgoing traffic.Centralized API management for microservices.
Example ToolsNginx, Traefik, Kubernetes Ingress.Egress Gateways (Istio, Calico).Kong, Istio, Amazon API Gateway, Apigee.

tại sao chạy e2e test using docker compose ?

-> embbed postgres (jonkey)

worker gọi master khi nào và ngược lại?

kubelet

What are use cases for each types of AWS Load Balancer?

FeatureApplication LB (ALB)Network LB (NLB)Gateway LB (GWLB)Classic LB (CLB)
Layer7 (Application)4 (Transport)3 (Network)4 & 7
ProtocolsHTTP, HTTPS, WebSocketTCP, UDP, TLSIPHTTP, HTTPS, TCP
Advanced RoutingPath, Host-basedNot SupportedNot SupportedNot Supported
TargetsEC2, Lambda, IPs, ContainersEC2, IPsVirtual AppliancesEC2 only
LatencyModerateUltra-lowModerateModerate
Best forWeb applications, APIsReal-time applicationsSecurity toolsLegacy workloads

not ALB -> CLB ? when we need other protocol in layer 7 (DNS, SMTP, FTP,…) except HTTP & HTTPS not NLB -> CLB ? when you need features like Sticky Sessions, SSL Termination apply tracing into Morpheuslabs, Zipkin

worker gọi master khi nào và ngược lại?

Why API Server not sending request to Kubelet, but Kubelet have to make a request to API Server??? Not yet

  1. Scalability
  • Each connection to API Server will be manage by Kubelet
  • Reduce the heavy workload for API Server in pull-based model
  1. Reliability
  • In push model, if the API Server fail every pending request will be lost
  • In pull model, Kubelet will operate the retry mechanism base on the last known state
  • API Server + ETCD act as a source of truth, they don’t have to manage the Kubelet state

How to measure performance of a (MySQL) server???

  • Throughput: Measures how many queries MySQL can process in a second. Example: 10,000 queries executed in 10 seconds = 1,000 QPS. Formula: Throughput=Total Queries Executed/Execution Time​
  • Latency (Execution Time): The time it takes to execute a single query.
  • Connections (Concurrency): Maximum concurrent connections supported without degradation in performance.
  • I/O Performance: Measures the speed of read/write operations

before coredns is there any mechanism to resolve DNS in k8s cluster???

Kube-DNS (https://github.com/kubernetes/dns)

tool draw -> code -> diagram, có gọi là diagram as code ko? dựa vào đâu gọi nó là diagram as code?

CODE as source of truth

What is digital signatures

How pub/sec keys of CA are use in PKI?

pub -> decrypt | prv -> encrypt

normal case, encrypt = pub key because multi clients -> server decrypt (harder) => prv (need to protect) uses for decrypt

digital signature, encrypt = prv (harder) only server can encrypt, pub key used to decrypt

diff CA digital signature (DS) vs server DS

what does server’s certificate used for?

  • Authentication
  • Encryption

what is a protocol?

A set of rules for:

  • formatting
  • processing data

Example: Transmission Control Protocol (TCP)

  • Data process:

    • Connection setup: 3-way handshake
    • Data transmission: send & acknowledge data packet
  • Format:

    • TCP Header Example:
    [Source Port: 16 bits][Destination Port: 16 bits]
    [Sequence Number: 32 bits][Acknowledgment Number: 32 bits]
    [Data Offset][Flags][Window Size][Checksum][Urgent Pointer]
    
    • Data Section: Contains the payload being transmitted.

why protocols is needed?

These rules are used to create a common language for computers which use different software but still want to communicate to each other

what is TLS?

  • security protocol
  • designed to facilitate privacy and data security

what is mTLS?

an extension of TLS, not only Server send certificate to Client but the Client also need to send its certificate to Server

in K8s use TLS or mTLS? where?

  • mTLS is used to communicate internally in the cluster
  • TLS is used for external client (e.g. a client send a request to a service in K8s cluster)

can we CA in k8s cluster for web?

  • No, because the root CA can not be downloaded by client

EKS authn request from kubectl?

IAM role + access entry -> cluster user

Service to pod

Over the different iterations of Kubernetes, the method in favor of enabling this has changed, but the two main methods are via

  • the use of iptables (mostly) -> a pseudo L4 LB
  • the newer IP Virtual Server (IPVS)
  • eBPF-based dataplane (from cloud)

Network plugin-ins types

  • kubenet (simple, dont consume IP -> routing mechanism???)
  • plug-ins follows CNI specification

What is the term to describe the seperation of seperate control plane & data plane?

Decoupling

What does Control/Data Plane need?

Control plane: Consistent

Data plane: Reliable

why ETCD is chosen?

(C)onsistency & (P)artition Tolerance (NoSQL??) in CAP

Does ETCD still achieve high availability, after choosing CP?

Yes, but it requires more effort to make it achieve HA

  • frequently backup
  • manage Quorum properly (odd-number)

Why should ETCD number of nodes be kept as odd-number?

  • optimally maximize High Availability, for example: both 3 nodes and 4 nodes cluster can tolerate 1 failure node
  • increase chance of partition

which object will do load balance Ingress or Service?

Answer: both

Ingress:

  • Layer 7
  • When the Service that Ingress routes to is a headless Service

Service:

  • Layer 3

flow of IP allocation by CNI

cni-flow

Fault Tolerance vs HA

0 downtime vs 99,999%

Scaling vs Elastic

elastic = scale in/out AND up/down while scaling up/out