Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
docker-for-mac-kubernetes
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
et-public
docker-for-mac-kubernetes
Commits
ff94583b
Commit
ff94583b
authored
6 years ago
by
Xueshan Feng
Browse files
Options
Downloads
Patches
Plain Diff
Added deploying docker-compose to kubernetes example.
parent
39976ab1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+72
-0
72 additions, 0 deletions
README.md
example/docker-compose.yml
+26
-0
26 additions, 0 deletions
example/docker-compose.yml
example/web/static/index.html
+7
-0
7 additions, 0 deletions
example/web/static/index.html
with
105 additions
and
0 deletions
README.md
+
72
−
0
View file @
ff94583b
...
...
@@ -230,8 +230,80 @@ Now you can connect to the guestbook application on http://127.0.0.1:8000 and si
You can terminate the proxy by Control-C to in the proxy window.
## Deploy to Kubernetes from a docker-compose file
We are going to demo how to deploy docker-compose file to Kubernetes cluster.
* First clone this repo:
```
console
$ git clone https://code.stanford.edu/sfeng/docker-for-mac-kubernetes
```
* Deploy a word web application
```
console
$ DOCKER_ORCHESTRATOR=kubernetes docker stack deploy docker-web --compose-file docker-compose.yml
Ignoring unsupported options: build
Stack docker-web was created
Waiting for the stack to be stable and running...
-
Service words has one container running
-
Service db has one container running
-
Service web has one container running
Stack docker-web is stable and running
```
* Verify pods and service are running
```
console
$ docker stack services docker-web
ID NAME MODE REPLICAS IMAGE PORTS
f37955ad-3e8 docker-web_db replicated 1/1 dockerdemos/lab-db
f37c0e41-3e8 docker-web_web replicated 1/1 dockerdemos/lab-web
*
:80->80/tcp
f38e0067-3e8 docker-web_words replicated 5/5 dockerdemos/lab-words
```
Or if you want to use kubectl:
```
console
$ kubectl get pods,svc
NAME READY STATUS RESTARTS AGE
po/db-cc6d959d-t2j8l 1/1 Running 0 1m
po/web-bf8c55f48-56d2v 1/1 Running 0 1m
po/words-657d8f455b-bv6vk 1/1 Running 0 1m
po/words-657d8f455b-f9bjf 1/1 Running 0 1m
po/words-657d8f455b-lkdll 1/1 Running 0 1m
po/words-657d8f455b-ltq26 1/1 Running 0 1m
po/words-657d8f455b-t85ls 1/1 Running 0 1m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
svc/db ClusterIP None
<none>
55555/TCP 1m
svc/kubernetes ClusterIP 10.96.0.1
<none>
443/TCP 3h
svc/web ClusterIP None
<none>
55555/TCP 1m
svc/web-published LoadBalancer 10.110.27.41 localhost 80:31119/TCP 1m
svc/words ClusterIP None
<none>
55555/TCP 1m
`svc/web-published`
is the frontend that exposed to external host. Just point your browser to
http://localhost:80. You get
`hello-world!`
*
To update the content, edi the web/static/index.html, then
```
console
$
DOCKER_ORCHESTRATOR
=
kubernetes docker stack up docker-web
--compose-file
docker-compose.yml
```
*
List stacks
## Teardown
*
Delete the docker-web applicaiton if you deployed it
```
console
$
DOCKER_ORCHESTRATOR
=
kubernetes docker stack
rm
docker-web
Removing stack: docker-web
```
*
Delete dashboard application
```
console
...
...
This diff is collapsed.
Click to expand it.
example/docker-compose.yml
0 → 100644
+
26
−
0
View file @
ff94583b
version
:
'
3.3'
services
:
web
:
build
:
web
image
:
dockerdemos/lab-web
volumes
:
-
"
./web/static:/static"
ports
:
-
"
80:80"
words
:
build
:
words
image
:
dockerdemos/lab-words
deploy
:
replicas
:
5
endpoint_mode
:
dnsrr
resources
:
limits
:
memory
:
16M
reservations
:
memory
:
16M
db
:
build
:
db
image
:
dockerdemos/lab-db
This diff is collapsed.
Click to expand it.
example/web/static/index.html
0 → 100644
+
7
−
0
View file @
ff94583b
<html>
<header><title>
Kubernetes with Docker-for-Mac
</title></header>
<body>
Hello World!
</body>
</html>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment