INTERVIEW PREP
Interview questions
570 questions from real DevOps, SRE, platform engineering and MLOps interviews, with the answer an interviewer wants to hear. Try answering out loud first, then open the model answer.
Showing 106–120 of 490 questions
106.How do you write the address of a Docker image in Artifactory?MidJFrog Artifactory & Nexus
With the repository path method it is HOST/REPOSITORY/IMAGE:TAG, for example repo.example.com/docker-dev-local/shop-api:1.4.2. Sub-domain and port methods also exist, but need extra DNS or ports.
107.Why is replication not a backup?SeniorJFrog Artifactory & Nexus
Replication copies changes, including mistakes. If syncDeletes is on, an accidental delete can spread to every site. You still need separate, tested backups of the database and filestore.
108.What is the difference between a pipeline, a stage and a job?BeginnerGitLab CI/CD
A job is a list of commands that runs in a fresh environment and passes or fails. A stage is a group of jobs that run at the same time. A pipeline is one run of all the jobs for one commit. Stages run in order, and the next stage starts only when every job in the stage before it passed.
109.What is a GitLab runner?BeginnerGitLab CI/CD
A program that runs the jobs. It connects out to GitLab, asks for work, runs each job (usually in a Docker container or a Kubernetes pod) and sends back the log and artifacts. GitLab.com gives you shared runners; companies often run their own for speed, cost, special hardware or access to private networks.
110.What is the difference between artifacts and cache?BeginnerGitLab CI/CD
Artifacts pass a job's results (like a dist/ folder or a test report) to later jobs, and they must be there. Cache keeps downloaded packages (like .npm/) between pipelines to save time, and it may be missing. If a job would be wrong without the files, use artifacts; if it would only be slower, use cache.
111.How do you keep secrets out of your pipeline code?BeginnerGitLab CI/CD
Store them as CI/CD variables in Settings, marked masked (hidden in logs) and protected (only given to protected branches). Never commit them. For cloud access, prefer short-lived OIDC tokens (id_tokens) or a secret manager like Vault, so nothing long-lived is stored at all.
112.What is a merge request, and what happens when you write 'Closes #12' in one?BeginnerGitLab CI/CD
A merge request asks to merge one branch into another. It shows the changes, the pipeline result, approvals and security findings. 'Closes #12' links issue #12 and closes it automatically when the MR is merged into the default branch.
113.Why use npm ci instead of npm install in CI?BeginnerGitLab CI/CD
npm ci installs exactly the versions in package-lock.json and fails if the lock file is out of date. npm install can quietly change versions. In CI you want every build to be the same.
114.Your merge request pipeline is missing some jobs. What is the most likely cause?MidGitLab CI/CD
Jobs without rules don't run in merge request pipelines (their old default only covers branches and tags). Add rules to them, for example rules: - when: on_success, or rules that match merge_request_event. Also check workflow: rules, which can filter out the whole pipeline.
115.How do you stop getting two pipelines (branch and merge request) for one push?MidGitLab CI/CD
Use workflow: rules. Run a pipeline for merge request events, skip branch pipelines when the branch has an open MR ($CI_OPEN_MERGE_REQUESTS), and keep branch pipelines otherwise. GitLab ships this as the Workflows/MergeRequest-Pipelines template.
116.What does needs do, and when would you use it?MidGitLab CI/CD
needs lets a job start as soon as the jobs it lists are done, instead of waiting for whole earlier stages. needs: [] starts a job right away. Use it to run tests and lint at the same time as the build, which can cut pipeline time a lot. Jobs only download artifacts from the jobs they need.
117.A job is stuck in pending. How do you debug it?MidGitLab CI/CD
Check: does any online runner have all of the job's tags? Is the job untagged while no runner takes untagged jobs? Is the only matching runner protected while this is a feature branch? Is the runner offline or paused (gitlab-runner status, Settings > CI/CD > Runners)? Or are all runners simply busy?
118.How do you build a Docker image inside a GitLab job?MidGitLab CI/CD
The docker command needs a daemon, which a job container doesn't have. Options: a docker:dind service (needs a privileged runner), binding the host's Docker socket (fast but unsafe on shared runners), or a daemonless builder like BuildKit rootless or Buildah. Log in with CI_REGISTRY_USER and CI_REGISTRY_PASSWORD using --password-stdin, and tag images with the commit ID.
119.How do you set up review apps, and how do they get cleaned up?MidGitLab CI/CD
A deploy job with environment: name: review/$CI_COMMIT_REF_SLUG and its own URL runs for each merge request. Its on_stop names a stop job with the same environment and action: stop, which GitLab runs when the MR is merged or the branch is deleted. auto_stop_in: 1 week removes forgotten ones.
120.How do you deploy to Kubernetes from GitLab without storing a cluster password?MidGitLab CI/CD
Use the GitLab agent for Kubernetes. It runs in the cluster and connects out to GitLab. Its config file grants ci_access to chosen projects, which then get a kube context in their jobs (kubectl config use-context group/project:agent). For production, set protected_branches_only: true so only protected branches can deploy.