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

Chapter 2 kubectl deployment doesn't work on a real cluster #27

Closed
dwschulze opened this issue May 2, 2020 · 4 comments
Closed

Chapter 2 kubectl deployment doesn't work on a real cluster #27

dwschulze opened this issue May 2, 2020 · 4 comments

Comments

@dwschulze
Copy link

In chapter 2 the command you show to deploy the myhello application gives a different output than you show when I run it on the master of a 3 node cluster:

$ kubectl run demo --image=dwschulze/myhello --port=9999 --labels app=demo
pod/demo created

The output you show is:

deployment.apps "demo" created

When I try to do the port forwarding it fails because I have no deployments.

Do I need a deployment.yaml to deploy this onto a real cluster, or is there a different kubectl command I use?

@dwschulze
Copy link
Author

This is the command that is needed on a cluster:

$ sudo kubectl create deployment demo --image=demo

Maybe on a single node too?

@domingusj
Copy link
Contributor

domingusj commented May 3, 2020

@dwschulze thanks for opening an issue!

Are you by chance running version 1.18 of Kubernetes?

I think the issue you are experiencing could be due to a change in the 1.18 release. The latest release of Kubernetes back when the book was published was 1.10 or 1.11 so this could be a case where Kubernetes has changed something and our example no longer works with newer versions.

After searching docs between 1.17 and 1.18 it looks like kubectl run no longer creates a Deployment:

1.17 docs (https://v1-17.docs.kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#run)
Creates a deployment or job to manage the created container(s).

1.18 docs (https://v1-18.docs.kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#run)
Create and run a particular image in a pod.

Let us know if that lines up with your current version and we'll get an update to the Known Issues section in the demo repo with an updated example.

@dwschulze
Copy link
Author

I'm running 1.18.2. Should probably go into the errata too.

@domingusj
Copy link
Contributor

PR merged with updated Known Issue in the README.

(Not sure why GitHub labeled the PR as "Closed" instead of "Merged").

Also submitted errata to O'Reilly.

Thank you @dwschulze for catching this!

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

2 participants