-
Notifications
You must be signed in to change notification settings - Fork 4
Deploy Kubernetes
Here's how to set up and run an Apache Tomcat server on a Kubernetes cluster. The following examples assume that you have prepared Photon Controller to deploy Kubernetes clusters by following the instructions in Creating a Kubernetes Cluster.
First, create a new cluster on Photon Controller for the Tomcat server:
photon service create -n Kube2 -k KUBERNETES --dns 192.168.209.2 \
--gateway 192.168.209.2 --netmask 255.255.255.0 --master-ip 192.168.209.35 \
--load-balancer-ip 192.168.209.34 \
--container-network 10.2.0.0/16 --etcd1 192.168.209.36 -c 2
The container network should be in CIDR format (for example, 10.2.0.0/16).
If you're deploying the cluster on VMware Workstation, skip the creation of etcd node 2 to work within the size constraints of your environment.
Now we want to deploy a basic web server application onto the Kubernetes cluster we created.
Make sure you have the kubectl
tool installed on your workstation. To download the kubectl
utility, see Installing and Setting Up kubectl.
Grab the files below:
- Apache Tomcat Replication Controller yml
- Apache Tomcat Service yml
Now we can create an application by deploying a replication controller and the corresponding service. There may be a several minute delay while the image downloads on the first deployment.
kubectl -s 192.168.209.35:8080 create -f <path_to_rc>.yml
kubectl -s 192.168.209.35:8080 create -f <path_to_service>.yml
The pods should now be running. Confirm with this command:
kubectl -s 192.168.209.35:8080 get pods
You should see "Running" on the pods you've created.
Congrats: You now have an Apache Tomcat server running on the Kubernetes cluster.
We can view our Tomcat application at the following URL:
http://192.168.209.35:30001
We can scale out to multiple Replication Controllers quite easily by using
kubectl
:
kubectl -s 192.168.209.35:8080 scale --replicas=2 rc tomcat-server
After scaling, use kubectl
to make sure you have two copies of the Tomcat
Server pod:
kubectl -s 192.168.209.35:8080 get pods
After you deploy your app on this cluster, you may need to delete it in order to create additional clusters in a small environment. When you are ready to delete it, run the following command:
photon service delete <cluster_uuid>
- Home
- Installation Guide
- Download Photon Controller
- Release Notes
- User Guide
- Installation and Setup
- Administration and Operations
- Command-Line Cheat Sheet
- Overview of Commands
- Authenticating Multitenant Users and Groups
- Authorization Model
- Connecting to the Load Balancer and Logging In
- Tenants, Quotas, and Projects
- Creating Tenants, Projects, and Quotas
- Working with Tenants
- Creating a Project
- Uploading Images
- Creating Images
- Replicating Images in Datastores
- Creating Flavors
- Working with Virtual Machines
- Using a Photon OS VM
- Creating a Network
- Performing Host Maintenance
- Working with ESXi Hosts
- Configuring Your Own Load Balancer
- Troubleshooting
- Deploying Clusters
- Integration
- API
- Information for Developers
- References
- Legal