Or you can just accept that you'll have ants now and then. My grandmother battled ants her whole life. My mother didn't seem to have ants in her kitchen. I have ants in kitchen and bathroom. Lots of ants at times and none at other times.
I do put out ant traps. The ants take the poison back to their home and viola no ants for awhile. They come back in and I put out traps. It's a cycle. I've decided it's not worth my focus to be sure I have no ants. After all, they do not carry germs. They are not a health hazard.
At first I did try to figure out where they were coming in. I traced them to window in the bathroom but couldn't find where in the kitchen. There is, no doubt a crack or two or more in the wall or floor. I think they do come in from outside. That's the usual source. I don't see them in the basement. Sometimes in the living room but traps in the kitchen and bathroom eliminate even those.
When I see a trail thru the back door, I spray with a bug spray outside the door. I've had new seals put on my storm door and haven't seen ants there since.
Years ago I stopped trying to get rid of them and we've been living together peaceably ever since. LOL