Is your California Kingsnake eating regularly and as usual or is he not too interested much in food?
Have you noticed that he will eat smaller food items than usual and less frequently in addition to the rubbing and trying to get out of the vivarium constantly?
This behaviour is very common in large Male California Kingsnakes, it usually means he wants to mate because he is in full on breeding mode and this behaviour will not stop or go away until he has mated or September comes round.
Solution go get him a Female snake to have fun with. You need to watch them constantly for the first few hours to see if they settle down and they are going to get on. Do NoT be surprised IF he smells her, then starts jerking and moving strangely, rubbing his body against everything, then he bites her on the neck or round the middle. This is NoT a feeding response it is a mating thing.
Do NoT be surprised if she runs off at a rate of knotts with him in HoT pursuit. It is part of the mating ritual, she gives him the run around! (typical female) LoL.
Well this is one very good possibility for the behaviour you described.