brikis98 / terraform-up-and-running-code

Code samples for the book "Terraform: Up & Running" by Yevgeniy Brikman
http://www.terraformupandrunning.com/
MIT License
2.83k stars 1.9k forks source link

Ch7: K8s example doesn't start #107

Closed mhadam closed 9 months ago

mhadam commented 9 months ago
module.simple_webapp.kubernetes_service.app: Creating...
module.simple_webapp.kubernetes_deployment.app: Creating...
module.simple_webapp.kubernetes_service.app: Still creating... [10s elapsed]
module.simple_webapp.kubernetes_deployment.app: Still creating... [10s elapsed]
module.simple_webapp.kubernetes_deployment.app: Creation complete after 15s [id=default/simple-webapp]
module.simple_webapp.kubernetes_service.app: Still creating... [20s elapsed]
module.simple_webapp.kubernetes_service.app: Still creating... [30s elapsed]
module.simple_webapp.kubernetes_service.app: Still creating... [40s elapsed]
module.simple_webapp.kubernetes_service.app: Still creating... [50s elapsed]
module.simple_webapp.kubernetes_service.app: Still creating... [1m0s elapsed]
module.simple_webapp.kubernetes_service.app: Still creating... [1m10s elapsed]
[...]

I'm certain the code is fine, but for whatever reason this won't start. I'm on an apple sillicon macbook, so perhaps there's an issue there. I notice that host port 5000 is bound by some mac system service but don't see why that would interfere with k8s.

mhadam commented 9 months ago

I'll close this, but just for historical purposes and to save anyone the frustration I went through:

I figured this out...after banging my head on the wall for a while, realized that httpd was serving on port 80 (this seems to be default behavior for macOS) and that was preventing the service from being created.

This command showed httpd listening on port 80:

sudo lsof -i :80

Solution: run this command before running the k8s example:

sudo apachectl stop