  We derive the galaxy luminosity function in the $K_s$ band for galaxies in 24
clusters to provide a local reference for higher redshift studies and to
analyse how and if the luminosity function varies according to environment and
cluster properties. We use new, deep $K$ band imaging and match the photometry
to available redshift information and to optical photometry from the SDSS or
the UKST/POSS: $>80\%$ of the galaxies to $K \sim 14.5$ have measured
redshifts. We derive composite luminosity functions, for the entire sample and
for cluster subsamples . We consider the luminosity functions for red sequence
and blue cloud galaxies. The full composite luminosity function has $K^*=12.79
\pm 0.14$ ($M_K=-24.81$) and $\alpha=-1.41 \pm 0.10$. We find that $K^*$ is
largely unaffected by the environment but that the slope $\alpha$ increases
towards lower mass clusters and clusters with Bautz-Morgan type $<$ II. The red
sequence luminosity function seems to be approximately universal (within
errors) in all environments: it has parameters $K^*=13.16 \pm 0.15$
($M_K=-24.44$) and $\alpha=-1.00 \pm 0.12$ (for all galaxies). Blue galaxies do
not show a good fit to a Schechter function, but the best values for its
parameters are $K^*=13.51 \pm 0.41$ ($M_K=-24.09$) and $\alpha=-1.60 \pm 0.29$:
we do not have enough statistics to consider environmental variations for these
galaxies. We find some evidence that $K^*$ in clusters is brighter than in the
field and $\alpha$ is steeper, but note this comparison is based (for the
field) on 2MASS photometry, while our data are considerably deeper.
