By TprLab
I have a kub deployment to expose as LoadBalancer. Created with Terraform, looks good. But when I create a service to expose, it returns empty response all the time.
resource "kubernetes_service" "front" {
metadata {
name = "front"
}
spec {
selector = {
App = "front"
}
port {
port = 8000
}
type = "LoadBalancer"
}
}
Checked cluster status and found the service endpoint was not created by some reason.
If I delete the service with kubectl and re-create it as:
–kubeconfig ~/.kube/my-doks-config.yaml expose deployment front --type LoadBalancer
Everything is fine, endpoint created, the service exposed and working as expected.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there,
I am not a terraform user so I may not be the most helpful here.
Can you verify whether there are any error logs during this? Either to stdout or to a log file somewhere for terraform?
Does this issue only aoccur with an LB service? Are you able to create any kind of service?
perhaps try and see if the “nginx” example here works from the terraform docs: https://learn.hashicorp.com/tutorials/terraform/kubernetes-provider?in=terraform/kubernetes
That should give you an idea if the provider you are using is having an issue or if its your configuration of your service.
Hope this helps!
John Kwiatkoski
No errors found, except the missed endpoint. The issue occurs with both LB and ClusterIp, when I tried to expose the service via ingress.
“Nginx” example is NodePort, it was working, but it is too basic. The provider - DO Managed Kubernetes. So I gave up with TF and returned to kubectl - everything works correctly.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.