mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-06 11:42:14 +00:00
Merge pull request #11424 from lavalamp/mungePreformatted
Munge preformatted
This commit is contained in:
@@ -62,6 +62,7 @@ gcloud config set project <project-name>
|
||||
```
|
||||
|
||||
Next, start up a Kubernetes cluster:
|
||||
|
||||
```shell
|
||||
wget -q -O - https://get.k8s.io | bash
|
||||
```
|
||||
@@ -81,6 +82,7 @@ files to your existing Meteor project `Dockerfile` and
|
||||
|
||||
`Dockerfile` should contain the below lines. You should replace the
|
||||
`ROOT_URL` with the actual hostname of your app.
|
||||
|
||||
```
|
||||
FROM chees/meteor-kubernetes
|
||||
ENV ROOT_URL http://myawesomeapp.com
|
||||
@@ -89,6 +91,7 @@ ENV ROOT_URL http://myawesomeapp.com
|
||||
The `.dockerignore` file should contain the below lines. This tells
|
||||
Docker to ignore the files on those directories when it's building
|
||||
your container.
|
||||
|
||||
```
|
||||
.meteor/local
|
||||
packages/*/.build*
|
||||
@@ -103,6 +106,7 @@ free to use this app for this example.
|
||||
|
||||
Now you can build your container by running this in
|
||||
your Meteor project directory:
|
||||
|
||||
```
|
||||
docker build -t my-meteor .
|
||||
```
|
||||
@@ -113,6 +117,7 @@ Pushing to a registry
|
||||
For the [Docker Hub](https://hub.docker.com/), tag your app image with
|
||||
your username and push to the Hub with the below commands. Replace
|
||||
`<username>` with your Hub username.
|
||||
|
||||
```
|
||||
docker tag my-meteor <username>/my-meteor
|
||||
docker push <username>/my-meteor
|
||||
@@ -122,6 +127,7 @@ For [Google Container
|
||||
Registry](https://cloud.google.com/tools/container-registry/), tag
|
||||
your app image with your project ID, and push to GCR. Replace
|
||||
`<project>` with your project ID.
|
||||
|
||||
```
|
||||
docker tag my-meteor gcr.io/<project>/my-meteor
|
||||
gcloud docker push gcr.io/<project>/my-meteor
|
||||
@@ -139,17 +145,20 @@ We will need to provide MongoDB a persistent Kuberetes volume to
|
||||
store its data. See the [volumes documentation](../../docs/user-guide/volumes.md) for
|
||||
options. We're going to use Google Compute Engine persistent
|
||||
disks. Create the MongoDB disk by running:
|
||||
|
||||
```
|
||||
gcloud compute disks create --size=200GB mongo-disk
|
||||
```
|
||||
|
||||
Now you can start Mongo using that disk:
|
||||
|
||||
```
|
||||
kubectl create -f examples/meteor/mongo-pod.json
|
||||
kubectl create -f examples/meteor/mongo-service.json
|
||||
```
|
||||
|
||||
Wait until Mongo is started completely and then start up your Meteor app:
|
||||
|
||||
```
|
||||
kubectl create -f examples/meteor/meteor-service.json
|
||||
kubectl create -f examples/meteor/meteor-controller.json
|
||||
@@ -161,12 +170,14 @@ the Meteor pods are started. We also created the service before creating the rc
|
||||
aid the scheduler in placing pods, as the scheduler ranks pod placement according to
|
||||
service anti-affinity (among other things). You can find the IP of your load balancer
|
||||
by running:
|
||||
|
||||
```
|
||||
kubectl get service meteor --template="{{range .status.loadBalancer.ingress}} {{.ip}} {{end}}"
|
||||
```
|
||||
|
||||
You will have to open up port 80 if it's not open yet in your
|
||||
environment. On Google Compute Engine, you may run the below command.
|
||||
|
||||
```
|
||||
gcloud compute firewall-rules create meteor-80 --allow=tcp:80 --target-tags kubernetes-minion
|
||||
```
|
||||
@@ -181,6 +192,7 @@ to get an insight of what happens during the `docker build` step. The
|
||||
image is based on the Node.js official image. It then installs Meteor
|
||||
and copies in your apps' code. The last line specifies what happens
|
||||
when your app container is run.
|
||||
|
||||
```
|
||||
ENTRYPOINT MONGO_URL=mongodb://$MONGO_SERVICE_HOST:$MONGO_SERVICE_PORT /usr/local/bin/node main.js
|
||||
```
|
||||
@@ -203,6 +215,7 @@ more information.
|
||||
As mentioned above, the mongo container uses a volume which is mapped
|
||||
to a persistent disk by Kubernetes. In [`mongo-pod.json`](mongo-pod.json) the container
|
||||
section specifies the volume:
|
||||
|
||||
```
|
||||
"volumeMounts": [
|
||||
{
|
||||
@@ -213,6 +226,7 @@ section specifies the volume:
|
||||
|
||||
The name `mongo-disk` refers to the volume specified outside the
|
||||
container section:
|
||||
|
||||
```
|
||||
"volumes": [
|
||||
{
|
||||
|
Reference in New Issue
Block a user