Public Repository

Last pushed: a year ago
Short Description
Tomcat image for Chapter 1
Full Description

Tomcat image for 《Kubernetes权威指南》 Chapter 1

tag v2 is for rolling-update test, the webpage is updated.

There are 2 ways to make tomcat-app connect to mysql successfully:
1. Use Env "MYSQL_SERVICE_HOST" to connect to mysql service
Prerequisite: create mysql service first
tomcat-app.yaml (note: no env spec):

apiVersion: v1
kind: ReplicationController
metadata:
  name: myweb
spec:
  replicas: 1
  selector:
    app: myweb
  template:
    metadata:
      labels:
        app: myweb
    spec:
      containers:
        - name: myweb
          image: kubeguide/tomcat-app:v1
          ports:
          - containerPort: 8080

2. use service name "mysql" to connect to mysql service
Prerequisite: kubernetes dns (skydns or dnsmasq) must be installed and running successfully.
Change tomcat-app.yaml, specify env MYSQL_SERVICE_HOST=mysql

apiVersion: v1
kind: ReplicationController
metadata:
  name: myweb
spec:
  replicas: 5
  selector:
    app: myweb
  template:
    metadata:
      labels:
        app: myweb
    spec:
      containers:
        - name: myweb
          image: kubeguide/tomcat-app:v1
          ports:
          - containerPort: 8080
          env:
          - name: MYSQL_SERVICE_HOST
            value: 'mysql'
Docker Pull Command
Owner
kubeguide