A pore-scale model is presented to simulate the dynamic ion transport and adsorption processes in porous electrodes used for capacitive deionization (CDI). The Stokes equation governing water flow is solved using the lattice Boltzmann method and Nernst-Planck equation describing ion transport is solved using the finite volume method. The ion adsorption process is considered at the surface of carbon electrodes. After validation against analytical solutions and published results, the model is used to study the coupled water flow, ion transport and adsorption in both two-dimensional and three-dimensional porous CDI electrodes at the pore scale. The effect of electrode microstructure, electrical potential and flow velocity on the adsorption processes is quantitatively investigated, and the relative importance of various parameters is determined. The presented model can be a powerful numerical tool to quantitatively analyze ion transport and adsorption in porous electrodes, and may provide useful information for the design and optimization of CDI electrodes and operating conditions for desired desalination efficiency, water throughput and cost.