crusader-kings-2 (it may also be true for CK3, I'm just not as familiar with that game.)
Generally, if you want to go to war over a title, you first need a claim.
You can use the "Fabricate Claim on Liege" plot to gain a claim on the Kingdom, which you can then press to take over. You can also try to inherit a claim. This would also allow you to start a faction to become ruler of the kingdom. This can give you vital allies and may even lead to you ruling without a war, if the current King accepts the demands of your faction.
There is another option that doesn't require a claim. If you control 51% or more of the counties of the kingdom, you can fight a war for independence and usurp the title afterwards (there are some more conditions for usurpation). This will only give you the de jure title of the kingdom, all its other vassals (including the former King, assuming he held titles within the kingdom) will be released as independent counties and duchies. You will have to conquer or vassalize them separately, if you want to reunify the kingdom.