Bird
0
0

Which minimal YAML snippet correctly defines a GitRepository resource for FluxCD to track a Git repository at 'https://github.com/example/repo.git'?

easy📝 Syntax Q3 of 15
Kubernetes - Advanced Deployment Patterns
Which minimal YAML snippet correctly defines a GitRepository resource for FluxCD to track a Git repository at 'https://github.com/example/repo.git'?
AapiVersion: source.toolkit.fluxcd.io/v1beta2 kind: GitRepository metadata: name: repo spec: url: https://github.com/example/repo.git
BapiVersion: source.toolkit.fluxcd.io/v1beta2 kind: GitRepository metadata: name: repo spec: branch: main
CapiVersion: source.toolkit.fluxcd.io/v1beta2 kind: GitRepository metadata: name: repo spec: interval: 1m
DapiVersion: source.toolkit.fluxcd.io/v1beta2 kind: GitRepository metadata: name: repo spec: path: ./deploy
Step-by-Step Solution
Solution:
  1. Step 1: Identify required fields

    The minimal GitRepository resource requires apiVersion, kind, metadata with a name, and spec with the repository URL.
  2. Step 2: Verify URL presence

    apiVersion: source.toolkit.fluxcd.io/v1beta2 kind: GitRepository metadata: name: repo spec: url: https://github.com/example/repo.git includes the 'url' field pointing to the Git repository, which is mandatory.
  3. Step 3: Check other options

    Options B, C, and D miss the 'url' field, making them invalid minimal definitions.
  4. Final Answer:

    Option A -> Option A
  5. Quick Check:

    Minimal GitRepository requires 'url' in spec [OK]
Quick Trick: GitRepository must specify 'url' in spec [OK]
Common Mistakes:
  • Omitting the 'url' field in spec
  • Confusing 'branch' or 'path' as mandatory
  • Using incorrect apiVersion or kind

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes