Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ch03 - Basic service is not working as expected. #59

Open
realalien opened this issue Dec 28, 2022 · 0 comments
Open

Ch03 - Basic service is not working as expected. #59

realalien opened this issue Dec 28, 2022 · 0 comments

Comments

@realalien
Copy link

After creating a service with following code,

apiVersion: v1
kind: Service
metadata:
  name: sleep-2
spec:
  selector:
    app: sleep-2
  ports:
    - port: 80

the command kubectl exec deploy/sleep-1 -- ping -c 1 sleep-2 will throw error like ping: bad address 'sleep-2' command terminated with exit code 1 ,
while the kubectl exec deploy/sleep-1 -- ping -c 2 $(kubectl get pod -l app=sleep-2 --output jsonpath='{.items[0].status.podIP}') works just fine.

The manual of Kubernetes Service is hard to digest for noobie like me, what's the cause?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant