New getting started blog post#14970
Conversation
I'd like to submit a blog post for the kubernetes.io blog targeted to people just getting started with Kubernetes. I myself am still new to it but want to start writing more to share what I am learning and help others along the way. My point of view is a little different than most people who post on the kubernetes.io blog since I am an independent consultant and I also work mostly with Microsoft products - so some of my resources are from Microsoft which seems rare for some reason in most Kubernetes blog posts I find on the web.
|
Welcome @JasonHaley! |
|
Deploy preview for kubernetes-io-master-staging ready! Built with commit f675b07 https://deploy-preview-14970--kubernetes-io-master-staging.netlify.com |
|
I have 4 images to include but didn't get them included on the PR. I couldn't figure out how to add the images, I don't see a directory in the repo that has images from the other blogs. How can I' get the images added? /assign @kbarnard10 |
|
@JasonHaley Thanks for your PR.You can add images to |
I added the image files and changed the paths in the markdown to /static/images/blog/...
|
I added the images and modified the markdown, but I believe the md and images may not be in the right location now (i think they are off the root of the repo). Sorry that - this is my first pull request on a public repo, so I'm learning my way here. Is there something I need to do to fix the location now? Should I just start over with a new pull request? /assign @zacharysarah |
|
I can't take a look at this until next week but would be happy to help get your images and links sorted. |
|
Ok, thank you. Again sorry for any trouble due to me not adding the images in the initial PR.
From: Jorge O. Castro <notifications@github.com>
Sent: Wednesday, June 19, 2019 11:04 AM
To: kubernetes/website <website@noreply.github.com>
Cc: Jason Haley <jason@jasonhaley.com>; Mention <mention@noreply.github.com>
Subject: Re: [kubernetes/website] New getting started blog post (#14970)
I can't take a look at this until next week but would be happy to help get your images and links sorted.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#14970?email_source=notifications&email_token=ABAXYFCDNDBZZG4RZIPLUTLP3JDH3A5CNFSM4HZEYDLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYCEZLI#issuecomment-503598253>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABAXYFCQE252BGECEDYPH4LP3JDH3ANCNFSM4HZEYDLA>.
|
|
@JasonHaley Dont't worry. This guide may help a little. And I think the file name may need some change. |
|
Yeah I read through that guide which is where I messed up. the "Create new file" button works great but I think I could have used some direction at that point for what to do with any images. Once I created the initial PR, I couldn't figure out the multiple files after the fact. |
|
Oh I see. It's better to add some guide for the image location. |
| @@ -0,0 +1,217 @@ | |||
| --- | |||
There was a problem hiding this comment.
I think this file location needs to be changed. 😄
And help needed from native English speaker to review the content.
|
@JasonHaley I just created a PR to your repo to fix the path. Please check and do the merge. |
|
I merged @zhangqx2010 image path fixes. /assign @kbarnard10 |
|
@JasonHaley |
|
|
||
| There are only two files in this directory. If you look at the main.py file, you’ll see the application prints out a hello message. You can learn more about Flask on the [Flask website](http://flask.pocoo.org/). | ||
|
|
||
| ``` |
There was a problem hiding this comment.
Hi. If you wanted to have this highlighted as Python you could do that (append python to this line). What do you think?
There was a problem hiding this comment.
Not a bad idea. It would make sense that someone may want to also learn more about Python, though originally I didn't really want to highlight a specific language. My original title didn't have it in there either but I got some feedback that it might make sense to put it in the title.
Added a date to get it on netlify preview
There was a problem hiding this comment.
I added a date in the header. Not sure what the next step is. /assign @kbarnard10
jaypipes
left a comment
There was a problem hiding this comment.
Hi @JasonHaley, great beginner's writeup, thank you! I've left a few comments/suggestions inline, but nothing too major.
| ``` | ||
| pip install -r requirements.txt | ||
| python main.py | ||
| ``` |
There was a problem hiding this comment.
You may wish to put a note here mentioning that running pip install isn't recommended for most scenarios. Instead, it's more common practice to use virtualenv (or pyenv) and install dependencies within a virtual environment.
There was a problem hiding this comment.
Ok, once again that shows how much of a beginner I am in Python. Thank you for your review notes, they really add to the quality of the blog!
| 3. Set the working directory to that new app directory. | ||
| 4. Copy the local directory’s contents to that new folder into the image. | ||
| 5. Run the pip installer (just like we did earlier) to pull the requirements into the image. | ||
| 6. Configure port 5000 to be open. |
There was a problem hiding this comment.
It's not really that EXPOSE "opens" a port or actually that EXPOSE performs any action at all. Rather, it serves more as documentation to the user of the image that the service daemon running in the image is listening on a particular port. This allows the user of the image to set up a port redirection on the host by calling docker run -P or docker run -p.
There was a problem hiding this comment.
Oh wow, that totally shows how much of a beginner I am - I wasn't aware of that it really doesn't do anything in the Dockerfile.
| ### Create an image | ||
| At your command line or shell, in the hello-python/app directory, build the image with the following command: | ||
| ``` | ||
| docker build -f Dockerfile -t hello-python:latest . |
There was a problem hiding this comment.
Might be worth mentioning in a note here that using the :latest tag on an image can be error-prone. See here for more information: https://container-solutions.com/docker-latest-confusion/
There was a problem hiding this comment.
I added a note about that and pointed to the link, but I'm not sure if it belongs. See what you think.
|
|
||
| Now let’s have it run the application. Create a file named deployment.yaml and add the following contents to it and then save it: | ||
|
|
||
| ``` |
There was a problem hiding this comment.
use the following here to enable syntax highlighting:
```yaml
There was a problem hiding this comment.
Very cool, I didn't know that.
|
|
||
| Make sure it is using the Docker for Desktop context by running the following: | ||
| ``` | ||
| kubectl config use-context docker-for-desktop |
There was a problem hiding this comment.
I'm not sure this is needed or recommended for readers not using Windows (or Mac?). Perhaps worth prefacing the above with "If you are running on Windows or Mac, make sure.."
There was a problem hiding this comment.
Ok, I'm definitely coming from a windows point of view, so thanks that helps broaden the message.
| 3. Create a deployment and run the application in Kubernetes | ||
|
|
||
| ## Prerequisites | ||
| * [Docker Desktop with Kubernetes](https://www.docker.com/products/kubernetes) installed (see end of blog for enabling Kubernetes) |
There was a problem hiding this comment.
Might be better to just list "A Kubernetes service" here, possibly with a link to the various installation methods here: https://kubernetes.io/docs/setup/.
There was a problem hiding this comment.
Ok, that makes sense I work that in. One of the ideas I had with this blog was get across the message that if you are already working with Docker, it is easy to also start learning Kubernetes (instead of Docker Swarm) with the tools you already have.
| ``` | ||
| <img src="/images/blog/get-started-with-kubernetes-using-python/kubectl-get-pods.png" alt="Pod listing" /> | ||
|
|
||
| Now navigate to http://localhost:6001, and you should see the “Hello form Python!” message. |
There was a problem hiding this comment.
The load balancer is exposed on port 6000 in the configuration above, not 6001.
There was a problem hiding this comment.
Thanks, nice catch!
mrbobbytables
left a comment
There was a problem hiding this comment.
Overall looks pretty solid, one small suggestion and I'd +1 @jaypipes comments.
| type: LoadBalancer | ||
|
|
||
| --- | ||
| apiVersion: apps/v1beta1 |
There was a problem hiding this comment.
| apiVersion: apps/v1beta1 | |
| apiVersion: apps/v1 |
With the upcoming deprecation of apps/v1beta1 I would suggest using the stable v1 api
There was a problem hiding this comment.
Cool, I wasn't aware of that.
|
I worked in some good fixes from @mrbobbytables and @jaypipes. /assign @kbarnard10 @castrojo @vonguard |
|
Any update on this? |
|
/lgtm |
|
I can take a gander tomorrow first thing. Poke me if I don't reply after
noon.
…On Tue, Jul 16, 2019, 2:08 PM Jason Haley ***@***.***> wrote:
@castrojo <https://github.com/castrojo> or @vonguard
<https://github.com/vonguard> any chance you can take a look at this soon?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#14970?email_source=notifications&email_token=AAAPJQCZZII4FQGPBETNYDTP7Y2GXA5CNFSM4HZEYDLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2CFC2Q#issuecomment-511988074>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAPJQBOW5IUOOQ4DKWMKJ3P7Y2GXANCNFSM4HZEYDLA>
.
|
|
/lgtm |
|
@vonguard Thanks! Next questions is how does it get approved? |
|
/assign @kbarnard10 |
…-07-23-get-started-with-kubernetes-using-python.md
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kbarnard10 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/lgtm |
|
@kbarnard10 it seems the formatting is off when getting translated into html. Looks like a blockquote isn't getting closed right before the heading "Run locally". It shows fine in markdown here: https://github.com/kubernetes/website/blob/master/content/en/blog/_posts/2019-07-23-get-started-with-kubernetes-using-python.md But the code formatting gets inverted on this one: Do you know what I need to do to fix it? or do you know what component is used to convert from markdown to html? I can try and figure it out if so. |
I'd like to submit a blog post for the kubernetes.io blog targeted to people just getting started with Kubernetes. I myself am still new to it but want to start writing more to share what I am learning and help others along the way. My point of view is a little different than most people who post on the kubernetes.io blog since I am an independent consultant and I also work mostly with Microsoft products - so some of my resources are from Microsoft which seems rare for some reason in most Kubernetes blog posts I find on the web.