Since the maximal compact subgroup question has a complicated history, and is treated at very different levels of generality in the literature (Bruhat-Tits papers in particular), it may be helpful to fill in Paul's answer a bit. There was early work in special cases by Bruhat over half a century ago, in the aftermath of Chevalley's uniform 1955 construction of *split* groups over an arbitrary field coming from simple Lie algebras over $\mathbb{C}$. But the clearest picture began to emerge from the important 1965 paper by Iwahori and Matsumoto (see in particular their Prop. 2.32):
here.

In this approach and the further work of Bruhat-Tits one considers in particular a simple, simply connected algebraic group $G$ such as $\mathrm{SL}_n$ defined over a complete non-archimedian field $K$, obtaining a $(B,N)$-pair structure and Bruhat decomposition which leads eventually to a determination of the conjugacy classes of maximal compact subgroups of $G(K)$ (which are maximal "parahoric" subgroups): the number of these is $\ell +1$, where $\ell$ is the $K$-rank of $G$. The minimal "parahoric" subgroups are themselves all conjugate. Here the usual Weyl group is expanded to an affine (or extended affine) Weyl group.

The later papers by Bruhat and Tits develop such ideas in vast generality, but as early as 1966 their announcements of results show clearly the direction in which they were going. To state the technical results for $G(k_S)$ in the question here takes some care, but the basic example cited by Paul shows how the $\ell+1$ arises (the rank in his split example being $n-1$).

As Paul indicates, a direct computation can be done in the smallest case $\mathrm{SL}_2$. See for example the end of $\S15$ in my old Springer Lecture Notes 789 on arithmetic groups, where the Bruhat-Tits building appears as simply a tree and Serre's ideas about groups acting on trees can be used.