Petr,
Here is an interface I commonly use with proven real world results. I typically use QTY (3) fasteners, for small diameter applications) but one could use more. The fasteners are not really designed for taking the external hydro-static pressure load as the shoulder of the end-cap is pressing circumferentially on the outer-housing. Although technically at greater depths the fasteners could start to experience shear and bending loads from end-cap deformation (material dependent) but for the most part this will not be an issue.
The design intent of the fasteners are to create a removable "pin" that locates the end-cap and allows for easy assembly and dis-assembly. Notice the dual O-rings. You only need QTY(1) O-ring to seal but I use QTY(2) for redundancy. It is cheap insurance should you unknowingly damaged or contaminated your o-ring during end-cap installation.
Design Considerations:
1) Use larger O-ring diameters than pin hole diameters. If you do not, the O-ring will try to extrude out of the pin holes in the outer-housing and will cut your O-rings. With fatter O-rings this almost never happens .
2) Always use O-ring lube for O-ring installation. I prefer Dow-Corning DC-111 click
3) Should you have to have small O-rings relative to the diameter of your pin holes, located in your outer housing as seen below, you will need to create an installation tool to plug the holes in the outer housing-as I had to for this assembly. The installation tool was designed and 3D printed on my U-print.
See images below: