You need to check TLS certificate expiry for 400 domains and alert at 21 days. How do you build it?
IntermediateScenarioKubernetes, Docker, SSH & fleet automation
Answer
Situation read → Simple but valuable check.
What I'd do →
- For each domain, open a TLS connection with
ssl.create_default_context()andsocket.create_connection((host, 443), timeout=5), wrap withserver_hostname=host, readgetpeercert()["notAfter"], parse withssl.cert_time_to_seconds. - Run concurrently with a thread pool.
- Report domains below 21 days; also report connection or verification failures.
- Or export as metrics and use blackbox_exporter's
probe_ssl_earliest_cert_expiry.
Why → Expired certificates are a fully preventable outage.
Interview tip → Use SNI (server_hostname), or you get the wrong certificate on shared hosts.
More on Kubernetes, Docker, SSH & fleet automation
You need a report of every pod in the cluster with no CPU or memory limits. How do you write it?BeginnerYou are asked to write a small operator-like script that adds a label to every new namespace. How do you approach it?AdvancedYou need to restart all Deployments in a namespace that reference a rotated Secret. How?AdvancedYour CI runners keep running out of disk because of Docker images. Write a cleanup plan in Python.IntermediateYou need to run `df -h` on 300 Linux hosts and list any above 85%. Python or Ansible?BeginnerA Python script SSHes to hosts with `AutoAddPolicy`. Security says that is unacceptable. What do you change?Intermediate