Shimano METREA 1x11 from Shimano 3x8 Can I upgrade my bike with a METREA Urban crankset with chain guard 1x11-speed if my current system is Shimano FC-M171, 42/34/24 with bottom bracket Shimano BB UN26?

And can I install CS-5800 cassette if now is Shimano CS HG31, 11-32, 8-speed with Rear Hub Shimano FH-RM 35, 32h? Thanks for information!
Yes, Metrea cranks will fit on your bike, but you need a new bottom bracket. You have a threaded bottom bracket shell with a cartridge BB, Metrea cranks work with outboard Holowtech II BBs in the threaded shell. The Shimano spec pages says use an SM-BBR60.

Whether you can get an 11 speed cassette on the freehub depends on the size of cassette you use. Road 11 speed freehub bodies are slightly longer than 8-10 speed ones to accommodate the wider cassette, however, if the largest sprockets are big enough the cassette spider can overhang the hub a little and not interfere with the hub body or spokes. Many larger cassettes come with a spacer that is used on 11 speed freehub bodies and left off on 8-10 speed freehub bodies.