By default, ssh-keygen generates a private key in PEM format and an associated public key in some other format (not sure what this format is). This is fine for SSH authentication however if you need a standard OpenSSL compliant keypair there are two ways to generate as follows:

Using openssl:

Generate the private key

openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits:2048

Extract the public key:

openssl rsa -pubout -in private_key.pem -out public_key.pem

Using ssh-keygen:

Generate the keypair in the usual way:

ssh-keygen -b 2048 -t rsa -f key

Now generate a PEM version of the public key:

ssh-keygen -f key.pub -m pem -e > key.pub.pem