We present the design and implementation of libkrylov, an open-source library for solving matrix-free eigenvalue, linear, and shifted linear equations using Krylov subspace methods. The primary objectives of libkrylov are flexible API design and modular structure, which enables integration with specialized matrix-vector evaluation "engines." Libkrylov features pluggable preconditioning, orthonormalization, and tunable convergence control. Diagonal (conjugate gradient, CG), Davidson, and Jacobi-Davidson preconditioners are available, along with orthonormal and nonorthonormal (nKs) schemes. All functionality of libkrylov is exposed via Fortran and C application programming interfaces (APIs). We illustrate the performance of libkrylov for eigenvalue calculations arising in time-dependent density functional theory (TDDFT) in the Tamm-Dancoff approximation (TDA) and discuss the convergence behavior as a function of preconditioning and orthonormalization methods.