Solving the Diophantine equation $k^2 = a^2 - 4b + 8$ for $k,a,b$ We have the system of Diophantine equations in 4 variables
$$\begin{align}
a & = p+q \\
b-2 &= pq \tag 1
\end{align}$$
We have
$$\begin{align}
(p-q)^2 & = (p+q)^2 - 4pq \\
 & = a^2 - 4(b-2) \tag 2
\end{align}$$
Putting $p-q = k$, we need to solve the 3-variable Diophantine equation
$$
k^2 = a^2 - 4b + 8 \tag 3
$$
Assuming we have a solution for Eqn. (3), we can then solve
$$
p+q = a \\
p-q = k \tag 4
$$
I can get particular solutions for eg., if I set $b = 0$, then $k-a = \text{$d_i$, a divisor of 8}$ and $k+a = 8/d_i$.
How do I solve Eqn. (3) to obtain the general solutions?
If it helps to provide context, $a, b$ are the coefficients in a monic palindromic polynomial of degree 4.
$$
\begin{align}
f(x) & = x^4 + ax^3 + bx^2 + ax + 1 \\ 
& = (x^2 + px + 1)(x^2 + qx + 1) \\
& = x^4 + (p+q)x^3 + (pq+2)x^2 + (p+q)x + 1
\end{align} \tag 5
$$
Equating the coefficients, we get the original Eqn. (1).

Note: WolframAlpha gives the following parametric solutions for Eqn (3):
$$
\begin{align}
a & = 2 c_1, b = {c_1}^2 - {c_2}^2 + 2, k = 2 c_2, & \text{ where } c_1, c_2 \in \mathbb{Z} \\
a & = 2 c_1 + 1, b = {c_1}^2 + c_1 - {c_2}^2 + c_2 + 2, k = 2 c_2 - 1, & \text{ where } c_1, c_2 \in \mathbb{Z}
\end{align}
$$

Are these the only solutions?

If $a$ and $b$ are integer constants in your question, then $p$ and $q$ are obviously restricted and the pairs $(p,q)$ or $(q,p)$ are the roots of the quadratic equation $x^2-ax+(b-2)=0$ therefore $(p,q)$ is not always a pair of integers.
Thus, $a$ and $b$ cannot be considered as constants.
If $a,b,p,q$ are all integer variables, then you can construct the general solution set as follows:
$$\begin{align}&p=c_1\\
&q=c_2\\
&a=c_1+c_2\\
&b=c_1c_2+2\end{align}$$
where $c_1,c_2\in\mathbb Z$.
Thus, you can easily obtain the general solution you are looking for depending on the variables $a,b,k\,:$

$$
\begin{align}&a=c_1+c_2\\ 
&b=c_1c_2+2\\
&k=±(c_1-c_2)\end{align}
$$
where $c_1,c_2\in\mathbb Z$.

Indeed, we see that:
$$
\begin{align}(c_1-c_2)^2=(c_1+c_2)^2-4(c_1c_2+2)+8\end{align}
$$
Finally, observe that the solutions that Wolfram Alpha or other software generates for the equation $k^2=a^2-4b+8$ over integers, are a subset of the solution set we found.
