# Kubernetes vs Terraform: source lines of code compared

The Kubernetes vs Terraform comparison on OctoCounts shows side-by-side source line counts for kubernetes/kubernetes and hashicorp/terraform, counted with the same engine and analysis options on the dates shown in the methodology line: files, total lines, code lines, comment lines, blank lines, and per-language totals, pinned to the exact commits listed below.

As of 2026-09-14, kubernetes/kubernetes contains 4,806,584 total lines (3,871,272 code) across 14,894 files, while hashicorp/terraform contains 749,354 total lines (595,101 code) across 4,021 files as of 2026-09-16. kubernetes/kubernetes is about 6.5x the size of hashicorp/terraform by code lines. Code size is not code quality: a larger count only means more source material, not a better or worse project.

| Metric | [kubernetes/kubernetes](https://octocounts.com/github/kubernetes/kubernetes) | [hashicorp/terraform](https://octocounts.com/github/hashicorp/terraform) |
| --- | ---: | ---: |
| Files | 14,894 | 4,021 |
| Total lines | 4,806,584 | 749,354 |
| Code lines | 3,871,272 | 595,101 |
| Comment lines | 632,981 | 73,204 |
| Blank lines | 302,331 | 81,049 |
| Languages counted | 12 | 12 |

Top languages in kubernetes/kubernetes: Go (65.3% of code), JSON (26.7% of code), YAML (6.6% of code). Top languages in hashicorp/terraform: Go (92.8% of code), JSON (4.5% of code), HCL (2.3% of code). Go, JSON, Shell appear in both top language lists; YAML, PO File appear only in kubernetes/kubernetes's top languages; HCL, Protocol Buffers appear only in hashicorp/terraform's top languages.

Methodology: both counts come from cached OctoCounts reports generated with tokei. kubernetes/kubernetes was counted at ref master (commit 7dc2c90fe831) on 2026-09-14; hashicorp/terraform was counted at ref f8e7458f5e427027f5b25e24a433c56f049aed3d (commit f8e7458f5e42) on 2026-09-16. See the [counting methodology](https://octocounts.com/docs/methodology) for ignored directories and analysis options.
## About this comparison

kubernetes/kubernetes counts the Kubernetes core repository: the API server, scheduler, controller machinery, kubelet, and the client and staging packages, all in one Go monorepo. hashicorp/terraform counts the Terraform core repository: the configuration language, state machinery, plan/apply engine, and CLI; the provider plugins that talk to cloud APIs live in separate repositories. Both counts therefore measure a core system written predominantly in Go, counted on the dates shown above.

The per-language tables are dominated by Go on both sides, which makes this one of the more like-for-like comparisons on the site in implementation language; what differs is what each core excludes, since Terraform's providers sit in many separate repositories while Kubernetes counts its in-tree components.

Both trees carry sizeable test suites typical of infrastructure software, and the Kubernetes count additionally includes its vendored dependency tree, so a share of each total exists to support and protect the core rather than to run it directly.

_These counts do not measure cluster resource footprint, operational complexity, or how much code an end user manages — a Terraform configuration can provision a Kubernetes cluster whose own codebase dwarfs the configuration. The numbers describe the two core repositories only._

Sources: [kubernetes/kubernetes repository (core components)](https://github.com/kubernetes/kubernetes) · [hashicorp/terraform repository (core; providers live separately)](https://github.com/hashicorp/terraform). Statements verified 2026-09-16.

Evidence and next steps:

- [kubernetes/kubernetes SLOC report](https://octocounts.com/github/kubernetes/kubernetes)
- [hashicorp/terraform SLOC report](https://octocounts.com/github/hashicorp/terraform)
- [Compare kubernetes/kubernetes and hashicorp/terraform interactively](https://octocounts.com/compare?left=https%3A%2F%2Fgithub.com%2Fkubernetes%2Fkubernetes&right=https%3A%2F%2Fgithub.com%2Fhashicorp%2Fterraform)

Note: code size is not code quality. OctoCounts only reports reproducible line counts and makes no claim that either project is better.

## Compare FAQ

### Which has more lines of code, kubernetes/kubernetes or hashicorp/terraform?

kubernetes/kubernetes has more code: 3,871,272 code lines versus 595,101 for hashicorp/terraform, about 6.5x as much, based on cached OctoCounts reports as of 2026-09-16.

### Does more source lines of code mean more complexity?

Not necessarily. SLOC measures size, not complexity, quality, or maintainability. A larger codebase can mean more features, more generated or vendored code, more verbose language idioms, or more tests — none of which imply the code is harder to work with. Use SLOC to gauge the scale of what you'd be reading or maintaining, not as a quality signal for kubernetes/kubernetes, hashicorp/terraform, or any repository.

### How is this comparison calculated?

Methodology: both counts come from cached OctoCounts reports generated with tokei. kubernetes/kubernetes was counted at ref master (commit 7dc2c90fe831) on 2026-09-14; hashicorp/terraform was counted at ref f8e7458f5e427027f5b25e24a433c56f049aed3d (commit f8e7458f5e42) on 2026-09-16. See the counting methodology for ignored directories and analysis options.

### Can I compare a different branch, tag, or commit?

Yes. This page shows the default branch for each repository. Use the interactive comparison tool to pick any public GitHub repository, branch, tag, or commit SHA for both sides and get a fresh side-by-side report.

## Related OctoCounts pages

- [Interactive repository comparison](https://octocounts.com/compare)
- [Recently analyzed repositories](https://octocounts.com/recent)
- [Popular SLOC reports](https://octocounts.com/popular)
- [Trending GitHub repositories](https://octocounts.com/trending)
- [Hall of Monoliths](https://octocounts.com/hall-of-monoliths)
- [Original research: how filtering changes SLOC counts](https://octocounts.com/research)
- [GitHub SLOC counter guide](https://octocounts.com/docs/github-sloc-counter)
- [Counting methodology](https://octocounts.com/docs/methodology)
- [SLOC and code metrics glossary](https://octocounts.com/docs/glossary)
- [OctoCounts API docs](https://octocounts.com/docs/api)
