Creating a custom page is optional but recommended because the site is accessible during part of the upgrade. This will prevent users from any access to the site and also informs that the site is undergoing maintenance
Steps
Go into the pub/errors
Create a copy of the local.xml.sample and rename it as local.xml
Edit the <skin> with your custom name. Ex – bondi
<?xml version="1.0"?>
<config>
<skin>bondi</skin>
</config

Next create a copy of the “default” folder and rename it with your skin name. Ex – bondi

Locate the 503.phtml inside the newly created folder and add your custom code. Add the styles inside css/styles.css and relevant images under images folder.

Refresh the page to see the changes
*Maintenance mode should be enabled
Use these commands to enable and disable the maintenance mode
able
php bin/magento maintenance:enable
php bin/magento maintenance:dis
To enable maintenance mode for all clients except chosen IP address,
php bin/magento maintenance:enable --ip=[ip address]
php bin/magento maintenance:enable --ip=192.168.1.1
To check the status,
php bin/magento maintenance:status