Here is a suggestion with package scrlayer-scrpage
. It uses layers for header and footer. It is possible to define new layers and add them to page styles.
So you can use a two new layers for the page numbers: one for odd pages and one for even pages.
In the following example the center of the baseline is 1cm above the lower page border and 2cm left/right of the outer page margin on odd/even pages.
\documentclass{book}
\usepackage{geometry}
\geometry{top=2cm,bottom=3cm,left=2cm,right=4cm,marginparwidth=2.8cm,marginparsep=1cm}
\usepackage{xcolor}
\usepackage{scrlayer-scrpage}
\clearpairofpagestyles
\addtokomafont{pagenumber}{\LARGE\bfseries}
\renewcommand\pagemark{\fcolorbox{black}{yellow!30}{\usekomafont{pagenumber}\thepage}}
\DeclareNewLayer[
oddpage,
background,
page,
addheight=-1cm,
addwidth=-2cm,
mode=picture,
contents=\putLR{\makebox[0pt][c]{\pagemark}}
]{pagenumber.odd}
\DeclareNewLayer[
clone=pagenumber.odd,
evenpage,
hoffset=2cm,
contents=\putLL{\makebox[0pt][c]{\pagemark}}
]{pagenumber.even}
\AddLayersToPageStyle{scrheadings}{pagenumber.odd,pagenumber.even}
\AddLayersToPageStyle{plain}{pagenumber.odd,pagenumber.even}
\usepackage{blindtext}
\usepackage{showframe}
\begin{document}
\chapter{A chapter}
\Blindtext[10]
\clearpage
\thispagestyle{empty}
{\Huge A page with empty page style.\par}
\clearpage
\Blindtext
\newgeometry{top=8cm,bottom=5cm,right=6cm,left=5cm,marginparwidth=2cm,marginparsep=3mm}
\Blindtext[10]
\end{document}