Out of the box, k6 supports the following protocols:
You can use k6 on more protocols with xk6.
By default, k6 uses HTTP/1.1 when it contacts a server. If the server reports to k6 that it supports HTTP/2, k6 upgrades the connection to HTTP/2 instead.
This is all automatic: you don't need to do anything special for either the initial use of HTTP/1.1 or the potential protocol upgrade. However, you might want to verify which protocol is actually being used for a transaction. This verification requires an extra step.
Using WebSockets is a bit different, for both the test structure and the VU lifecycle.
xk6 is a separate CLI tool that lets you build custom k6 binaries. Community contributors have already added support for additional protocols, with extensions for SQL, Kafka, ZeroMQ, Redis, and more. See the full list of extensions.
You can build your own extension, too. To get started, see this xk6 explanation and tutorial.