From 907db9483a231a37de753269b830c3f416a109b7 Mon Sep 17 00:00:00 2001 From: Mason Ferratt Date: Tue, 12 May 2020 10:41:50 -0700 Subject: [PATCH 1/4] converted the readme.md to a jupyter notebook --- ...p k8s Deployment Notebook-checkpoint.ipynb | 513 ++++++++++++++++++ ... Fitness App k8s Deployment Notebook.ipynb | 513 ++++++++++++++++++ 2 files changed, 1026 insertions(+) create mode 100644 kubernetes-manifests/.ipynb_checkpoints/ACME Fitness App k8s Deployment Notebook-checkpoint.ipynb create mode 100644 kubernetes-manifests/ACME Fitness App k8s Deployment Notebook.ipynb diff --git a/kubernetes-manifests/.ipynb_checkpoints/ACME Fitness App k8s Deployment Notebook-checkpoint.ipynb b/kubernetes-manifests/.ipynb_checkpoints/ACME Fitness App k8s Deployment Notebook-checkpoint.ipynb new file mode 100644 index 00000000..1fc58e1a --- /dev/null +++ b/kubernetes-manifests/.ipynb_checkpoints/ACME Fitness App k8s Deployment Notebook-checkpoint.ipynb @@ -0,0 +1,513 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# ACMEFIT K8s\n", + "\n", + "This repo contains a Polyglot demo application comprised of (presently) 6 microservices and 4 datastores.\n", + "\n", + "The contents here are the necessary YAML files to deploy the ACMEFIT application in a kubernetes cluster.\n", + "\n", + "This app is developed by team behind www.cloudjourney.io\n", + "\n", + "The current version of the application passes JSON Web Tokens (JWT) for authentication on certain API calls. The application will not work as expected if the `users` service is not present to issue / authenticate these tokens.\n", + "\n", + "## Datastore Dependent Services\n", + "\n", + "This section covers the deployment of the datastore dependent microservices. It is recommended to deploy these services first.\n", + "\n", + "### Cart Service\n", + "\n", + "Before deploying the cart datastore (Redis) and cart service please add a secret for the service to use in authenticating with the cache.\n", + "*Note: Please replace 'value' in the command below with the desired password text. Changing the name of the secret object or the 'password' key may cause deployment issues*\n" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Error from server (AlreadyExists): secrets \"cart-redis-pass\" already exists\r\n" + ] + } + ], + "source": [ + "!kubectl create secret generic cart-redis-pass --from-literal=password=VMware1!VMware1!\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Once the secret object is created, deploy the redis cache and cart service:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service/cart-redis created\n", + "deployment.apps/cart-redis created\n", + "service/cart created\n", + "deployment.apps/cart created\n" + ] + } + ], + "source": [ + "!kubectl apply -f cart-redis-total.yaml\n", + "!kubectl apply -f cart-total.yaml\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Catalog Service\n", + "\n", + "Before deploying the catalog datastore (mongo) and catalog service please add a secret for the service to use in authenticating with the cache.\n", + "*Note: Please replace 'value' in the command below with the desired password text. Changing the name of the secret object or the 'password' key may cause deployment issues*" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Error from server (AlreadyExists): secrets \"catalog-mongo-pass\" already exists\r\n" + ] + } + ], + "source": [ + "!kubectl create secret generic catalog-mongo-pass --from-literal=password=VMware1!" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Run the following command to initialize the catalog database with items:" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Error from server (AlreadyExists): error when creating \"catalog-db-initdb-configmap.yaml\": configmaps \"catalog-initdb-config\" already exists\r\n" + ] + } + ], + "source": [ + "!kubectl create -f catalog-db-initdb-configmap.yaml\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Finally, deploy the mongo instance and catalog service:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service/catalog-mongo created\n", + "deployment.apps/catalog-mongo created\n", + "service/catalog created\n", + "deployment.apps/catalog created\n" + ] + } + ], + "source": [ + "!kubectl apply -f catalog-db-total.yaml\n", + "!kubectl apply -f catalog-total.yaml" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "### Payment Service\n", + "\n", + "The payment service does not have an associated datastore. It can be deployed with the following command:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service/payment created\r\n", + "deployment.apps/payment created\r\n" + ] + } + ], + "source": [ + "!kubectl apply -f payment-total.yaml\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "NOTE: PAYMENT SERVICE MUST BE UP FIRST IN ORDER FOR ORDER SERVICE TO PROPERLY COMPLETE TRANSACTIONS\n", + " \n", + "### Order Service\n", + "\n", + "Before deploying the orders datastore (postgres) and order service please add a secret for the service to use in authenticating with the cache.\n", + "*Note: Please replace 'value' in the command below with the desired password text. Changing the name of the secret object or the 'password' key may cause deployment issues*\n", + "\n", + "Before running order please add the following secret:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "secret/order-postgres-pass created\r\n" + ] + } + ], + "source": [ + "!kubectl create secret generic order-postgres-pass --from-literal=password=VMware1!\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Once the secret object is created, deploy the mongo instance and order service:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service/order-postgres created\n", + "deployment.apps/order-postgres created\n", + "service/order created\n", + "deployment.apps/order created\n" + ] + } + ], + "source": [ + "!kubectl apply -f order-db-total.yaml\n", + "!kubectl apply -f order-total.yaml\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Users Service\n", + "\n", + "Before deploying the users datastore (mongo), users cache (redis) and users service please add secrets for the service to use in authenticating with the database and cache.\n", + "*Note: Please replace 'value' in the command below with the desired password text. Changing the name of the secret object or the 'password' key may cause deployment issues*\n", + "\n", + "Before running order please add the following secret:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "secret/users-mongo-pass created\n", + "secret/users-redis-pass created\n" + ] + } + ], + "source": [ + "!kubectl create secret generic users-mongo-pass --from-literal=password=VMware1!\n", + "!kubectl create secret generic users-redis-pass --from-literal=password=VMware1!\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Next you need to run the following to initialize the database with an initial set of users:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "configmap/users-initdb-config created\r\n" + ] + } + ], + "source": [ + "!kubectl create -f users-db-initdb-configmap.yaml\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Once the secret object is created, and the users database is seeded, deploy the users database and users service:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service/users-mongo created\n", + "deployment.apps/users-mongo created\n", + "service/users-redis created\n", + "deployment.apps/users-redis created\n", + "service/users created\n", + "deployment.apps/users created\n" + ] + } + ], + "source": [ + "!kubectl apply -f users-db-total.yaml\n", + "!kubectl apply -f users-redis-total.yaml\n", + "!kubectl apply -f users-total.yaml" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**_NOTE: The base set of users is preconfigured. For now, please login as one of this set (eric, dwight, han, or phoebe). The password for these users is 'vmware1!'_**\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Datastore Independent Services\n", + "\n", + "### Front End Service\n", + "\n", + "The front end service also functions without an associated datastore. The manifests in this repository deploy the front end service as a NodePort type for testing purposes. If suitable for the deployment environment, the service type could be changed to 'LoadBalancer' in the `frontend-total.yaml` manifest in this repository.\n", + "\n", + "To deploy the front end service, run the following command:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service/frontend created\r\n", + "deployment.apps/frontend created\r\n" + ] + } + ], + "source": [ + "!kubectl apply -f frontend-total.yaml\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To find the external port on which to access the site in browser, run the following command:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\r\n", + "frontend LoadBalancer 10.96.29.88 80:31947/TCP 55s\r\n" + ] + } + ], + "source": [ + "!kubectl get services -l service=frontend\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The output of the above command should be similar to this:\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "$ kubectl get services -l service=frontend\n", + "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\n", + "frontend NodePort 10.0.0.81 3000:30430/TCP 3d\n", + "\n", + "The external value appears under 'PORT(S)'. It is after the '3000:' and before the '/TCP' portion of the string. Appending it to the public address of the Kubernetes cluster (or loadbalancer fronting the cluster) to access the site.\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Point-of-Sales\n", + "\n", + "Just like the front end service, the Point-of-Sales app functions without any associated datastores. The only prerequisite is that the FrontEnd service is deployed. The manifests in this repository deploy the Point-of-Sales service as a NodePort type for testing purposes. If you're running the Point-of-Sales app on a different Kubernetes cluster, or as a standalone container, you'll have to update the value of `FRONTEND_HOST` (set to `frontend.default.svc.cluster.local` by default) to match the IP or FQDN of the front end service.\n", + "\n", + "To deploy the service, run the following command:\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service/pos created\r\n", + "deployment.apps/pos created\r\n" + ] + } + ], + "source": [ + "!kubectl apply -f point-of-sales-total.yaml" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To find the external port on which to access the site in browser, run the following command:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\r\n", + "pos NodePort 10.101.201.68 7777:30431/TCP 34s\r\n" + ] + } + ], + "source": [ + "!kubectl get services -l service=pos\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The output of the above command should be similar to this:\n", + "\n", + "```\n", + "$ kubectl get services -l service=frontend\n", + "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\n", + "pos NodePort 10.0.0.81 3000:30431/TCP 3d\n", + "```\n", + "\n", + "The external value appears under 'PORT(S)'. It is after the '3000:' and before the '/TCP' portion of the string. Appending it to the public address of the Kubernetes cluster (or loadbalancer fronting the cluster) to access the Point-of-Sales app." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Distributed Tracing\n", + "\n", + "**Note: Distributed tracing is advanced functionality which requires additional configuration to use successfully. Please read this section carefully before attempting to test / demonstrate tracing**\n", + "\n", + "The current version of the application has been augmented with distributed tracing funcionality. Each of the services has two relevant environment vairables `JAEGER_AGENT_HOST` and `JAEGER_AGENT_PORT`. Regardless of the span aggregator being used, the code expects that these two values to be populates with the hostname and port of whichever span collecter is being used *likely the jaeger agent*.\n", + "\n", + "To avoid issues with unresolvable hostnames, `JAEGER_AGENT_HOST` is set to `localhost` in all of the manifests in this repo. To use tracing, this value will need to be replaced. If using the `jaeger-all-in-one.yml` manifest included in this repo, this value should be changed to `.jaeger`.\n", + "\n", + "It is strongly recommended that the `JAEGER_AGENT_PORT` values not be modified as the tracing library implementations for specific languages favor certain ports." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.5" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/kubernetes-manifests/ACME Fitness App k8s Deployment Notebook.ipynb b/kubernetes-manifests/ACME Fitness App k8s Deployment Notebook.ipynb new file mode 100644 index 00000000..aaaf1d32 --- /dev/null +++ b/kubernetes-manifests/ACME Fitness App k8s Deployment Notebook.ipynb @@ -0,0 +1,513 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# ACMEFIT K8s\n", + "\n", + "This repo contains a Polyglot demo application comprised of (presently) 6 microservices and 4 datastores.\n", + "\n", + "The contents here are the necessary YAML files to deploy the ACMEFIT application in a kubernetes cluster.\n", + "\n", + "This app is developed by team behind www.cloudjourney.io\n", + "\n", + "The current version of the application passes JSON Web Tokens (JWT) for authentication on certain API calls. The application will not work as expected if the `users` service is not present to issue / authenticate these tokens.\n", + "\n", + "## Datastore Dependent Services\n", + "\n", + "This section covers the deployment of the datastore dependent microservices. It is recommended to deploy these services first.\n", + "\n", + "### Cart Service\n", + "\n", + "Before deploying the cart datastore (Redis) and cart service please add a secret for the service to use in authenticating with the cache.\n", + "*Note: Please replace 'value' in the command below with the desired password text. Changing the name of the secret object or the 'password' key may cause deployment issues*\n" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Error from server (AlreadyExists): secrets \"cart-redis-pass\" already exists\r\n" + ] + } + ], + "source": [ + "!kubectl create secret generic cart-redis-pass --from-literal=password=VMware1!\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Once the secret object is created, deploy the redis cache and cart service:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service/cart-redis created\n", + "deployment.apps/cart-redis created\n", + "service/cart created\n", + "deployment.apps/cart created\n" + ] + } + ], + "source": [ + "!kubectl apply -f cart-redis-total.yaml\n", + "!kubectl apply -f cart-total.yaml\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Catalog Service\n", + "\n", + "Before deploying the catalog datastore (mongo) and catalog service please add a secret for the service to use in authenticating with the cache.\n", + "*Note: Please replace 'value' in the command below with the desired password text. Changing the name of the secret object or the 'password' key may cause deployment issues*" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Error from server (AlreadyExists): secrets \"catalog-mongo-pass\" already exists\r\n" + ] + } + ], + "source": [ + "!kubectl create secret generic catalog-mongo-pass --from-literal=password=VMware1!" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Run the following command to initialize the catalog database with items:" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Error from server (AlreadyExists): error when creating \"catalog-db-initdb-configmap.yaml\": configmaps \"catalog-initdb-config\" already exists\r\n" + ] + } + ], + "source": [ + "!kubectl create -f catalog-db-initdb-configmap.yaml\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Finally, deploy the mongo instance and catalog service:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service/catalog-mongo created\n", + "deployment.apps/catalog-mongo created\n", + "service/catalog created\n", + "deployment.apps/catalog created\n" + ] + } + ], + "source": [ + "!kubectl apply -f catalog-db-total.yaml\n", + "!kubectl apply -f catalog-total.yaml" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "### Payment Service\n", + "\n", + "The payment service does not have an associated datastore. It can be deployed with the following command:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service/payment created\r\n", + "deployment.apps/payment created\r\n" + ] + } + ], + "source": [ + "!kubectl apply -f payment-total.yaml\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "NOTE: PAYMENT SERVICE MUST BE UP FIRST IN ORDER FOR ORDER SERVICE TO PROPERLY COMPLETE TRANSACTIONS\n", + " \n", + "### Order Service\n", + "\n", + "Before deploying the orders datastore (postgres) and order service please add a secret for the service to use in authenticating with the cache.\n", + "*Note: Please replace 'value' in the command below with the desired password text. Changing the name of the secret object or the 'password' key may cause deployment issues*\n", + "\n", + "Before running order please add the following secret:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "secret/order-postgres-pass created\r\n" + ] + } + ], + "source": [ + "!kubectl create secret generic order-postgres-pass --from-literal=password=VMware1!\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Once the secret object is created, deploy the mongo instance and order service:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service/order-postgres created\n", + "deployment.apps/order-postgres created\n", + "service/order created\n", + "deployment.apps/order created\n" + ] + } + ], + "source": [ + "!kubectl apply -f order-db-total.yaml\n", + "!kubectl apply -f order-total.yaml\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Users Service\n", + "\n", + "Before deploying the users datastore (mongo), users cache (redis) and users service please add secrets for the service to use in authenticating with the database and cache.\n", + "*Note: Please replace 'value' in the command below with the desired password text. Changing the name of the secret object or the 'password' key may cause deployment issues*\n", + "\n", + "Before running order please add the following secret:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "secret/users-mongo-pass created\n", + "secret/users-redis-pass created\n" + ] + } + ], + "source": [ + "!kubectl create secret generic users-mongo-pass --from-literal=password=VMware1!\n", + "!kubectl create secret generic users-redis-pass --from-literal=password=VMware1!\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Next you need to run the following to initialize the database with an initial set of users:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "configmap/users-initdb-config created\r\n" + ] + } + ], + "source": [ + "!kubectl create -f users-db-initdb-configmap.yaml\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Once the secret object is created, and the users database is seeded, deploy the users database and users service:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service/users-mongo created\n", + "deployment.apps/users-mongo created\n", + "service/users-redis created\n", + "deployment.apps/users-redis created\n", + "service/users created\n", + "deployment.apps/users created\n" + ] + } + ], + "source": [ + "!kubectl apply -f users-db-total.yaml\n", + "!kubectl apply -f users-redis-total.yaml\n", + "!kubectl apply -f users-total.yaml" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**_NOTE: The base set of users is preconfigured. For now, please login as one of this set (eric, dwight, han, or phoebe). The password for these users is 'vmware1!'_**\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Datastore Independent Services\n", + "\n", + "### Front End Service\n", + "\n", + "The front end service also functions without an associated datastore. The manifests in this repository deploy the front end service as a NodePort type for testing purposes. If suitable for the deployment environment, the service type could be changed to 'LoadBalancer' in the `frontend-total.yaml` manifest in this repository.\n", + "\n", + "To deploy the front end service, run the following command:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service/frontend created\r\n", + "deployment.apps/frontend created\r\n" + ] + } + ], + "source": [ + "!kubectl apply -f frontend-total.yaml\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To find the external port on which to access the site in browser, run the following command:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\r\n", + "frontend LoadBalancer 10.96.29.88 80:31947/TCP 55s\r\n" + ] + } + ], + "source": [ + "!kubectl get services -l service=frontend\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The output of the above command should be similar to this:\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "$ kubectl get services -l service=frontend\n", + "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\n", + "frontend NodePort 10.0.0.81 3000:30430/TCP 3d\n", + "\n", + "The external value appears under 'PORT(S)'. It is after the '3000:' and before the '/TCP' portion of the string. Appending it to the public address of the Kubernetes cluster (or loadbalancer fronting the cluster) to access the site.\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Point-of-Sales\n", + "\n", + "Just like the front end service, the Point-of-Sales app functions without any associated datastores. The only prerequisite is that the FrontEnd service is deployed. The manifests in this repository deploy the Point-of-Sales service as a NodePort type for testing purposes. If you're running the Point-of-Sales app on a different Kubernetes cluster, or as a standalone container, you'll have to update the value of `FRONTEND_HOST` (set to `frontend.default.svc.cluster.local` by default) to match the IP or FQDN of the front end service.\n", + "\n", + "To deploy the service, run the following command:\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service/pos created\r\n", + "deployment.apps/pos created\r\n" + ] + } + ], + "source": [ + "!kubectl apply -f point-of-sales-total.yaml" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To find the external port on which to access the site in browser, run the following command:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\r\n", + "pos NodePort 10.101.201.68 7777:30431/TCP 34s\r\n" + ] + } + ], + "source": [ + "!kubectl get services -l service=pos\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The output of the above command should be similar to this:\n", + "\n", + "```\n", + "$ kubectl get services -l service=frontend\n", + "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\n", + "pos NodePort 10.0.0.81 3000:30431/TCP 3d\n", + "```\n", + "\n", + "The external value appears under 'PORT(S)'. It is after the '3000:' and before the '/TCP' portion of the string. Appending it to the public address of the Kubernetes cluster (or loadbalancer fronting the cluster) to access the Point-of-Sales app." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Distributed Tracing\n", + "\n", + "**Note: Distributed tracing is advanced functionality which requires additional configuration to use successfully. Please read this section carefully before attempting to test / demonstrate tracing**\n", + "\n", + "The current version of the application has been augmented with distributed tracing funcionality. Each of the services has two relevant environment vairables `JAEGER_AGENT_HOST` and `JAEGER_AGENT_PORT`. Regardless of the span aggregator being used, the code expects that these two values to be populates with the hostname and port of whichever span collecter is being used *likely the jaeger agent*.\n", + "\n", + "To avoid issues with unresolvable hostnames, `JAEGER_AGENT_HOST` is set to `localhost` in all of the manifests in this repo. To use tracing, this value will need to be replaced. If using the `jaeger-all-in-one.yml` manifest included in this repo, this value should be changed to `.jaeger`.\n", + "\n", + "It is strongly recommended that the `JAEGER_AGENT_PORT` values not be modified as the tracing library implementations for specific languages favor certain ports." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.5" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} From dd15b5ab20713fd799c4bfb96d1728b8cb4cd4ea Mon Sep 17 00:00:00 2001 From: Mason Ferratt Date: Tue, 12 May 2020 10:56:26 -0700 Subject: [PATCH 2/4] created a jupyter notebook from the k8s readme.md --- ...s App k8s Deployment Notebook.ipynb => acmefit-notebook.ipynb} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename kubernetes-manifests/{ACME Fitness App k8s Deployment Notebook.ipynb => acmefit-notebook.ipynb} (100%) diff --git a/kubernetes-manifests/ACME Fitness App k8s Deployment Notebook.ipynb b/kubernetes-manifests/acmefit-notebook.ipynb similarity index 100% rename from kubernetes-manifests/ACME Fitness App k8s Deployment Notebook.ipynb rename to kubernetes-manifests/acmefit-notebook.ipynb From cce3f23431303f2edfa0ead4f6fda616bff9334e Mon Sep 17 00:00:00 2001 From: Mason Ferratt Date: Tue, 12 May 2020 16:35:42 -0700 Subject: [PATCH 3/4] added the following: 1. using the input function for the secretpassword 2. a cleanup section where all the acme app resources are deleted --- .../acmefit-notebook-checkpoint.ipynb | 814 ++++++++++++++++++ kubernetes-manifests/acmefit-notebook.ipynb | 367 +++++++- 2 files changed, 1148 insertions(+), 33 deletions(-) create mode 100644 kubernetes-manifests/.ipynb_checkpoints/acmefit-notebook-checkpoint.ipynb diff --git a/kubernetes-manifests/.ipynb_checkpoints/acmefit-notebook-checkpoint.ipynb b/kubernetes-manifests/.ipynb_checkpoints/acmefit-notebook-checkpoint.ipynb new file mode 100644 index 00000000..136a18e2 --- /dev/null +++ b/kubernetes-manifests/.ipynb_checkpoints/acmefit-notebook-checkpoint.ipynb @@ -0,0 +1,814 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# ACMEFIT K8s\n", + "\n", + "This repo contains a Polyglot demo application comprised of (presently) 6 microservices and 4 datastores.\n", + "\n", + "The contents here are the necessary YAML files to deploy the ACMEFIT application in a kubernetes cluster.\n", + "\n", + "This app is developed by team behind www.cloudjourney.io\n", + "\n", + "The current version of the application passes JSON Web Tokens (JWT) for authentication on certain API calls. The application will not work as expected if the `users` service is not present to issue / authenticate these tokens.\n", + "\n", + "## Datastore Dependent Services\n", + "\n", + "This section covers the deployment of the datastore dependent microservices. It is recommended to deploy these services first.\n", + "\n", + "### Cart Service\n", + "\n", + "Before deploying the cart datastore (Redis) and cart service please add a secret for the service to use in authenticating with the cache.\n", + "*Note: Please replace 'value' in the command below with the desired password text. Changing the name of the secret object or the 'password' key may cause deployment issues*\n" + ] + }, + { + "cell_type": "code", + "execution_count": 96, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a password for all k8s secrets: \n" + ] + } + ], + "source": [ + "secretpassword = str(input(\"Enter a password for all k8s secrets: \") or \"VMware1!\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": 97, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'VMware1!'" + ] + }, + "execution_count": 97, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "secretpassword" + ] + }, + { + "cell_type": "code", + "execution_count": 98, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "secret/cart-redis-pass created\r\n" + ] + } + ], + "source": [ + "!kubectl create secret generic cart-redis-pass --from-literal=password=secretpassword\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Once the secret object is created, deploy the redis cache and cart service:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 99, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service/cart-redis created\n", + "deployment.apps/cart-redis created\n", + "service/cart created\n", + "deployment.apps/cart created\n" + ] + } + ], + "source": [ + "!kubectl apply -f cart-redis-total.yaml\n", + "!kubectl apply -f cart-total.yaml\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Catalog Service\n", + "\n", + "Before deploying the catalog datastore (mongo) and catalog service please add a secret for the service to use in authenticating with the cache.\n", + "*Note: Please replace 'value' in the command below with the desired password text. Changing the name of the secret object or the 'password' key may cause deployment issues*" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "secret/catalog-mongo-pass created\r\n" + ] + } + ], + "source": [ + "!kubectl create secret generic catalog-mongo-pass --from-literal=password=secretpassword" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Run the following command to initialize the catalog database with items:" + ] + }, + { + "cell_type": "code", + "execution_count": 101, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "configmap/catalog-initdb-config created\r\n" + ] + } + ], + "source": [ + "!kubectl create -f catalog-db-initdb-configmap.yaml\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Finally, deploy the mongo instance and catalog service:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 102, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service/catalog-mongo created\n", + "deployment.apps/catalog-mongo created\n", + "service/catalog created\n", + "deployment.apps/catalog created\n" + ] + } + ], + "source": [ + "!kubectl apply -f catalog-db-total.yaml\n", + "!kubectl apply -f catalog-total.yaml" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Payment Service\n", + "\n", + "The payment service does not have an associated datastore. It can be deployed with the following command:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 103, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service/payment created\r\n", + "deployment.apps/payment created\r\n" + ] + } + ], + "source": [ + "!kubectl apply -f payment-total.yaml\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "NOTE: PAYMENT SERVICE MUST BE UP FIRST IN ORDER FOR ORDER SERVICE TO PROPERLY COMPLETE TRANSACTIONS\n", + " \n", + "### Order Service\n", + "\n", + "Before deploying the orders datastore (postgres) and order service please add a secret for the service to use in authenticating with the cache.\n", + "*Note: Please replace 'value' in the command below with the desired password text. Changing the name of the secret object or the 'password' key may cause deployment issues*\n", + "\n", + "Before running order please add the following secret:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 104, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "secret/order-postgres-pass created\r\n" + ] + } + ], + "source": [ + "!kubectl create secret generic order-postgres-pass --from-literal=password=secretpassword\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Once the secret object is created, deploy the mongo instance and order service:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 105, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service/order-postgres created\n", + "deployment.apps/order-postgres created\n", + "service/order created\n", + "deployment.apps/order created\n" + ] + } + ], + "source": [ + "!kubectl apply -f order-db-total.yaml\n", + "!kubectl apply -f order-total.yaml\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Users Service\n", + "\n", + "Before deploying the users datastore (mongo), users cache (redis) and users service please add secrets for the service to use in authenticating with the database and cache.\n", + "*Note: Please replace 'value' in the command below with the desired password text. Changing the name of the secret object or the 'password' key may cause deployment issues*\n", + "\n", + "Before running order please add the following secret:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 106, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "secret/users-mongo-pass created\n", + "secret/users-redis-pass created\n" + ] + } + ], + "source": [ + "!kubectl create secret generic users-mongo-pass --from-literal=password=secretpassword\n", + "!kubectl create secret generic users-redis-pass --from-literal=password=secretpassword\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Next you need to run the following to initialize the database with an initial set of users:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 107, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "configmap/users-initdb-config created\r\n" + ] + } + ], + "source": [ + "!kubectl create -f users-db-initdb-configmap.yaml\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Once the secret object is created, and the users database is seeded, deploy the users database and users service:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 108, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service/users-mongo created\n", + "deployment.apps/users-mongo created\n", + "service/users-redis created\n", + "deployment.apps/users-redis created\n", + "service/users created\n", + "deployment.apps/users created\n" + ] + } + ], + "source": [ + "!kubectl apply -f users-db-total.yaml\n", + "!kubectl apply -f users-redis-total.yaml\n", + "!kubectl apply -f users-total.yaml" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**_NOTE: The base set of users is preconfigured. For now, please login as one of this set (eric, dwight, han, or phoebe). The password for these users is 'vmware1!'_**\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Datastore Independent Services\n", + "\n", + "### Front End Service\n", + "\n", + "The front end service also functions without an associated datastore. The manifests in this repository deploy the front end service as a NodePort type for testing purposes. If suitable for the deployment environment, the service type could be changed to 'LoadBalancer' in the `frontend-total.yaml` manifest in this repository.\n", + "\n", + "To deploy the front end service, run the following command:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 109, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service/frontend created\n", + "deployment.apps/frontend created\n" + ] + } + ], + "source": [ + "!kubectl apply -f frontend-total.yaml\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To find the external port on which to access the site in browser, run the following command:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 110, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\r\n", + "frontend LoadBalancer 10.102.163.17 80:30601/TCP 0s\r\n" + ] + } + ], + "source": [ + "!kubectl get services -l service=frontend\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The output of the above command should be similar to this:\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "$ kubectl get services -l service=frontend\n", + "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\n", + "frontend NodePort 10.0.0.81 3000:30430/TCP 3d\n", + "\n", + "The external value appears under 'PORT(S)'. It is after the '3000:' and before the '/TCP' portion of the string. Appending it to the public address of the Kubernetes cluster (or loadbalancer fronting the cluster) to access the site.\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Point-of-Sales\n", + "\n", + "Just like the front end service, the Point-of-Sales app functions without any associated datastores. The only prerequisite is that the FrontEnd service is deployed. The manifests in this repository deploy the Point-of-Sales service as a NodePort type for testing purposes. If you're running the Point-of-Sales app on a different Kubernetes cluster, or as a standalone container, you'll have to update the value of `FRONTEND_HOST` (set to `frontend.default.svc.cluster.local` by default) to match the IP or FQDN of the front end service.\n", + "\n", + "To deploy the service, run the following command:\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 111, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service/pos created\n", + "deployment.apps/pos created\n" + ] + } + ], + "source": [ + "!kubectl apply -f point-of-sales-total.yaml" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To find the external port on which to access the site in browser, run the following command:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 112, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\r\n", + "pos NodePort 10.110.52.235 7777:30431/TCP 1s\r\n" + ] + } + ], + "source": [ + "!kubectl get services -l service=pos\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The output of the above command should be similar to this:\n", + "\n", + "```\n", + "$ kubectl get services -l service=frontend\n", + "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\n", + "pos NodePort 10.0.0.81 3000:30431/TCP 3d\n", + "```\n", + "\n", + "The external value appears under 'PORT(S)'. It is after the '3000:' and before the '/TCP' portion of the string. Appending it to the public address of the Kubernetes cluster (or loadbalancer fronting the cluster) to access the Point-of-Sales app." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Check that pods/services/deployments are running" + ] + }, + { + "cell_type": "code", + "execution_count": 113, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "NAMESPACE NAME READY STATUS RESTARTS AGE\r\n", + "cabpk-system pod/cabpk-controller-manager-7bf77b6ddb-lzprc 2/2 Running 85 178d\r\n", + "capd-system pod/capd-controller-manager-5cf7d47656-2zbf7 2/2 Running 91 178d\r\n", + "capi-system pod/capi-controller-manager-55b9d8ffc7-x96nt 1/1 Running 91 178d\r\n", + "default pod/cart-564f5c6c84-9qp8l 0/1 ContainerCreating 0 5s\r\n", + "default pod/cart-redis-78f644696b-f92rv 0/1 ContainerCreating 0 6s\r\n", + "default pod/catalog-6f4c978d85-4vtkb 0/1 ContainerCreating 0 4s\r\n", + "default pod/catalog-mongo-748f9c547b-tlzlh 0/1 ContainerCreating 0 5s\r\n", + "default pod/frontend-746bb69469-9mw6k 0/1 ContainerCreating 0 1s\r\n", + "default pod/order-d6fd9854b-rn6gm 0/1 ContainerCreating 0 3s\r\n", + "default pod/order-postgres-56bd5dcddd-xnfln 0/1 ContainerCreating 0 4s\r\n", + "default pod/payment-5644cddfb7-f6cl8 0/1 ContainerCreating 0 4s\r\n", + "default pod/pos-55c9d9d855-gxx45 0/1 ContainerCreating 0 0s\r\n", + "default pod/users-7d8485d99c-tlstl 0/1 ContainerCreating 0 1s\r\n", + "default pod/users-mongo-57869df5b5-q58gb 0/1 ContainerCreating 0 2s\r\n", + "default pod/users-redis-75b846d9db-rfpnr 0/1 ContainerCreating 0 2s\r\n", + "kube-system pod/coredns-fb8b8dccf-gwqtv 1/1 Running 68 178d\r\n", + "kube-system pod/coredns-fb8b8dccf-x6thq 1/1 Running 68 178d\r\n", + "kube-system pod/etcd-minikube 1/1 Running 2 178d\r\n", + "kube-system pod/kube-addon-manager-minikube 1/1 Running 2 178d\r\n", + "kube-system pod/kube-apiserver-minikube 1/1 Running 2 178d\r\n", + "kube-system pod/kube-controller-manager-minikube 1/1 Running 7 178d\r\n", + "kube-system pod/kube-proxy-mj8jg 1/1 Running 2 178d\r\n", + "kube-system pod/kube-scheduler-minikube 1/1 Running 8 178d\r\n", + "kube-system pod/storage-provisioner 1/1 Running 2 178d\r\n", + "kubernetes-dashboard pod/dashboard-metrics-scraper-5b4f756b59-d9427 1/1 Running 70 178d\r\n", + "kubernetes-dashboard pod/kubernetes-dashboard-556cc594db-mwmmn 1/1 Running 67 178d\r\n", + "\r\n", + "NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\r\n", + "cabpk-system service/cabpk-controller-manager-metrics-service ClusterIP 10.109.233.42 8443/TCP 178d\r\n", + "capd-system service/capd-controller-manager-metrics-service ClusterIP 10.102.181.22 8443/TCP 178d\r\n", + "default service/cart ClusterIP 10.97.231.107 5000/TCP 5s\r\n", + "default service/cart-redis ClusterIP 10.96.211.138 6379/TCP 6s\r\n", + "default service/catalog ClusterIP 10.110.169.35 8082/TCP 4s\r\n", + "default service/catalog-mongo ClusterIP 10.98.228.113 27017/TCP 5s\r\n", + "default service/frontend LoadBalancer 10.102.163.17 80:30601/TCP 1s\r\n", + "default service/kubernetes ClusterIP 10.96.0.1 443/TCP 178d\r\n", + "default service/order ClusterIP 10.104.11.183 6000/TCP 3s\r\n", + "default service/order-postgres ClusterIP 10.100.84.82 5432/TCP 4s\r\n", + "default service/payment ClusterIP 10.111.128.252 9000/TCP 4s\r\n", + "default service/pos NodePort 10.110.52.235 7777:30431/TCP 1s\r\n", + "default service/users ClusterIP 10.110.32.52 8083/TCP 1s\r\n", + "default service/users-mongo ClusterIP 10.111.227.3 27017/TCP 2s\r\n", + "default service/users-redis ClusterIP 10.96.79.94 6379/TCP 2s\r\n", + "kube-system service/kube-dns ClusterIP 10.96.0.10 53/UDP,53/TCP,9153/TCP 178d\r\n", + "kubernetes-dashboard service/dashboard-metrics-scraper ClusterIP 10.111.211.9 8000/TCP 178d\r\n", + "kubernetes-dashboard service/kubernetes-dashboard ClusterIP 10.104.196.129 80/TCP 178d\r\n", + "\r\n", + "NAMESPACE NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE\r\n", + "kube-system daemonset.apps/kube-proxy 1 1 1 1 1 178d\r\n", + "\r\n", + "NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE\r\n", + "cabpk-system deployment.apps/cabpk-controller-manager 1/1 1 1 178d\r\n", + "capd-system deployment.apps/capd-controller-manager 1/1 1 1 178d\r\n", + "capi-system deployment.apps/capi-controller-manager 1/1 1 1 178d\r\n", + "default deployment.apps/cart 0/1 1 0 5s\r\n", + "default deployment.apps/cart-redis 0/1 1 0 6s\r\n", + "default deployment.apps/catalog 0/1 1 0 4s\r\n", + "default deployment.apps/catalog-mongo 0/1 1 0 5s\r\n", + "default deployment.apps/frontend 0/1 1 0 1s\r\n", + "default deployment.apps/order 0/1 1 0 3s\r\n", + "default deployment.apps/order-postgres 0/1 1 0 4s\r\n", + "default deployment.apps/payment 0/1 1 0 4s\r\n", + "default deployment.apps/pos 0/1 1 0 0s\r\n", + "default deployment.apps/users 0/1 1 0 1s\r\n", + "default deployment.apps/users-mongo 0/1 1 0 2s\r\n", + "default deployment.apps/users-redis 0/1 1 0 2s\r\n", + "kube-system deployment.apps/coredns 2/2 2 2 178d\r\n", + "kubernetes-dashboard deployment.apps/dashboard-metrics-scraper 1/1 1 1 178d\r\n", + "kubernetes-dashboard deployment.apps/kubernetes-dashboard 1/1 1 1 178d\r\n", + "\r\n", + "NAMESPACE NAME DESIRED CURRENT READY AGE\r\n", + "cabpk-system replicaset.apps/cabpk-controller-manager-7bf77b6ddb 1 1 1 178d\r\n", + "capd-system replicaset.apps/capd-controller-manager-5cf7d47656 1 1 1 178d\r\n", + "capi-system replicaset.apps/capi-controller-manager-55b9d8ffc7 1 1 1 178d\r\n", + "default replicaset.apps/cart-564f5c6c84 1 1 0 5s\r\n", + "default replicaset.apps/cart-redis-78f644696b 1 1 0 6s\r\n", + "default replicaset.apps/catalog-6f4c978d85 1 1 0 4s\r\n", + "default replicaset.apps/catalog-mongo-748f9c547b 1 1 0 5s\r\n", + "default replicaset.apps/frontend-746bb69469 1 1 0 1s\r\n", + "default replicaset.apps/order-d6fd9854b 1 1 0 3s\r\n", + "default replicaset.apps/order-postgres-56bd5dcddd 1 1 0 4s\r\n", + "default replicaset.apps/payment-5644cddfb7 1 1 0 4s\r\n", + "default replicaset.apps/pos-55c9d9d855 1 1 0 0s\r\n", + "default replicaset.apps/users-7d8485d99c 1 1 0 1s\r\n", + "default replicaset.apps/users-mongo-57869df5b5 1 1 0 2s\r\n", + "default replicaset.apps/users-redis-75b846d9db 1 1 0 2s\r\n", + "kube-system replicaset.apps/coredns-fb8b8dccf 2 2 2 178d\r\n", + "kubernetes-dashboard replicaset.apps/dashboard-metrics-scraper-5b4f756b59 1 1 1 178d\r\n", + "kubernetes-dashboard replicaset.apps/kubernetes-dashboard-556cc594db 1 1 1 178d\r\n" + ] + } + ], + "source": [ + "!kubectl get all -A" + ] + }, + { + "cell_type": "code", + "execution_count": 114, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "|----------------------|------------------------------------------|----------------------------|-----|\r\n", + "| NAMESPACE | NAME | TARGET PORT | URL |\r\n", + "|----------------------|------------------------------------------|----------------------------|-----|\r\n", + "| cabpk-system | cabpk-controller-manager-metrics-service | No node port |\r\n", + "| capd-system | capd-controller-manager-metrics-service | No node port |\r\n", + "| default | cart | No node port |\r\n", + "| default | cart-redis | No node port |\r\n", + "| default | catalog | No node port |\r\n", + "| default | catalog-mongo | No node port |\r\n", + "| default | frontend | http://172.16.39.211:30601 |\r\n", + "| default | kubernetes | No node port |\r\n", + "| default | order | No node port |\r\n", + "| default | order-postgres | No node port |\r\n", + "| default | payment | No node port |\r\n", + "| default | pos | http://172.16.39.211:30431 |\r\n", + "| default | users | No node port |\r\n", + "| default | users-mongo | No node port |\r\n", + "| default | users-redis | No node port |\r\n", + "| kube-system | kube-dns | No node port |\r\n", + "| kubernetes-dashboard | dashboard-metrics-scraper | No node port |\r\n", + "| kubernetes-dashboard | kubernetes-dashboard | No node port |\r\n", + "|----------------------|------------------------------------------|----------------------------|-----|\r\n" + ] + } + ], + "source": [ + "#if using minikube you can use the target port url \n", + "!minikube service list" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Distributed Tracing\n", + "\n", + "**Note: Distributed tracing is advanced functionality which requires additional configuration to use successfully. Please read this section carefully before attempting to test / demonstrate tracing**\n", + "\n", + "The current version of the application has been augmented with distributed tracing funcionality. Each of the services has two relevant environment vairables `JAEGER_AGENT_HOST` and `JAEGER_AGENT_PORT`. Regardless of the span aggregator being used, the code expects that these two values to be populates with the hostname and port of whichever span collecter is being used *likely the jaeger agent*.\n", + "\n", + "To avoid issues with unresolvable hostnames, `JAEGER_AGENT_HOST` is set to `localhost` in all of the manifests in this repo. To use tracing, this value will need to be replaced. If using the `jaeger-all-in-one.yml` manifest included in this repo, this value should be changed to `.jaeger`.\n", + "\n", + "It is strongly recommended that the `JAEGER_AGENT_PORT` values not be modified as the tracing library implementations for specific languages favor certain ports." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Cleanup\n" + ] + }, + { + "cell_type": "code", + "execution_count": 115, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service \"pos\" deleted\n", + "deployment.apps \"pos\" deleted\n", + "service \"frontend\" deleted\n", + "deployment.apps \"frontend\" deleted\n", + "service \"users-mongo\" deleted\n", + "deployment.apps \"users-mongo\" deleted\n", + "service \"users-redis\" deleted\n", + "deployment.apps \"users-redis\" deleted\n", + "service \"users\" deleted\n", + "deployment.apps \"users\" deleted\n", + "configmap \"users-initdb-config\" deleted\n", + "secret \"users-mongo-pass\" deleted\n", + "secret \"users-redis-pass\" deleted\n", + "service \"order-postgres\" deleted\n", + "deployment.apps \"order-postgres\" deleted\n", + "service \"order\" deleted\n", + "deployment.apps \"order\" deleted\n", + "secret \"order-postgres-pass\" deleted\n", + "service \"payment\" deleted\n", + "deployment.apps \"payment\" deleted\n", + "service \"catalog-mongo\" deleted\n", + "deployment.apps \"catalog-mongo\" deleted\n", + "service \"catalog\" deleted\n", + "deployment.apps \"catalog\" deleted\n", + "configmap \"catalog-initdb-config\" deleted\n", + "secret \"catalog-mongo-pass\" deleted\n", + "service \"cart-redis\" deleted\n", + "deployment.apps \"cart-redis\" deleted\n", + "service \"cart\" deleted\n", + "deployment.apps \"cart\" deleted\n", + "secret \"cart-redis-pass\" deleted\n" + ] + } + ], + "source": [ + "#bulk delete of all deployments/services/pods/secrets in reverse order\n", + "!kubectl delete -f point-of-sales-total.yaml\n", + "!kubectl delete -f frontend-total.yaml\n", + "!kubectl delete -f users-db-total.yaml\n", + "!kubectl delete -f users-redis-total.yaml\n", + "!kubectl delete -f users-total.yaml\n", + "!kubectl delete -f users-db-initdb-configmap.yaml\n", + "!kubectl delete secret users-mongo-pass \n", + "!kubectl delete secret users-redis-pass \n", + "!kubectl delete -f order-db-total.yaml\n", + "!kubectl delete -f order-total.yaml\n", + "!kubectl delete secret order-postgres-pass \n", + "!kubectl delete -f payment-total.yaml\n", + "!kubectl delete -f catalog-db-total.yaml\n", + "!kubectl delete -f catalog-total.yaml\n", + "!kubectl delete -f catalog-db-initdb-configmap.yaml\n", + "!kubectl delete secret catalog-mongo-pass\n", + "!kubectl delete -f cart-redis-total.yaml\n", + "!kubectl delete -f cart-total.yaml\n", + "!kubectl delete secret cart-redis-pass " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Check that the pods/services were deleted" + ] + }, + { + "cell_type": "code", + "execution_count": 118, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "NAME READY STATUS RESTARTS AGE\r\n", + "pod/cart-564f5c6c84-9qp8l 1/1 Terminating 0 50s\r\n", + "pod/catalog-6f4c978d85-4vtkb 1/1 Terminating 0 49s\r\n", + "pod/frontend-746bb69469-9mw6k 0/1 Terminating 0 46s\r\n", + "pod/order-d6fd9854b-rn6gm 0/1 Terminating 0 48s\r\n", + "pod/order-postgres-56bd5dcddd-xnfln 0/1 Terminating 0 49s\r\n", + "pod/users-7d8485d99c-tlstl 0/1 Terminating 0 46s\r\n", + "pod/users-mongo-57869df5b5-q58gb 0/1 Terminating 0 47s\r\n", + "\r\n", + "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\r\n", + "service/kubernetes ClusterIP 10.96.0.1 443/TCP 178d\r\n" + ] + } + ], + "source": [ + "!kubectl get all" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.5" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/kubernetes-manifests/acmefit-notebook.ipynb b/kubernetes-manifests/acmefit-notebook.ipynb index aaaf1d32..136a18e2 100644 --- a/kubernetes-manifests/acmefit-notebook.ipynb +++ b/kubernetes-manifests/acmefit-notebook.ipynb @@ -26,19 +26,56 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 96, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Error from server (AlreadyExists): secrets \"cart-redis-pass\" already exists\r\n" + "Enter a password for all k8s secrets: \n" ] } ], "source": [ - "!kubectl create secret generic cart-redis-pass --from-literal=password=VMware1!\n" + "secretpassword = str(input(\"Enter a password for all k8s secrets: \") or \"VMware1!\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": 97, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'VMware1!'" + ] + }, + "execution_count": 97, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "secretpassword" + ] + }, + { + "cell_type": "code", + "execution_count": 98, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "secret/cart-redis-pass created\r\n" + ] + } + ], + "source": [ + "!kubectl create secret generic cart-redis-pass --from-literal=password=secretpassword\n" ] }, { @@ -50,7 +87,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 99, "metadata": {}, "outputs": [ { @@ -81,19 +118,19 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 100, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Error from server (AlreadyExists): secrets \"catalog-mongo-pass\" already exists\r\n" + "secret/catalog-mongo-pass created\r\n" ] } ], "source": [ - "!kubectl create secret generic catalog-mongo-pass --from-literal=password=VMware1!" + "!kubectl create secret generic catalog-mongo-pass --from-literal=password=secretpassword" ] }, { @@ -105,14 +142,14 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 101, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Error from server (AlreadyExists): error when creating \"catalog-db-initdb-configmap.yaml\": configmaps \"catalog-initdb-config\" already exists\r\n" + "configmap/catalog-initdb-config created\r\n" ] } ], @@ -129,7 +166,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 102, "metadata": {}, "outputs": [ { @@ -149,10 +186,8 @@ ] }, { - "cell_type": "code", - "execution_count": null, + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ "### Payment Service\n", "\n", @@ -161,7 +196,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 103, "metadata": {}, "outputs": [ { @@ -193,7 +228,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 104, "metadata": {}, "outputs": [ { @@ -205,7 +240,7 @@ } ], "source": [ - "!kubectl create secret generic order-postgres-pass --from-literal=password=VMware1!\n" + "!kubectl create secret generic order-postgres-pass --from-literal=password=secretpassword\n" ] }, { @@ -217,7 +252,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 105, "metadata": {}, "outputs": [ { @@ -250,7 +285,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 106, "metadata": {}, "outputs": [ { @@ -263,8 +298,8 @@ } ], "source": [ - "!kubectl create secret generic users-mongo-pass --from-literal=password=VMware1!\n", - "!kubectl create secret generic users-redis-pass --from-literal=password=VMware1!\n" + "!kubectl create secret generic users-mongo-pass --from-literal=password=secretpassword\n", + "!kubectl create secret generic users-redis-pass --from-literal=password=secretpassword\n" ] }, { @@ -276,7 +311,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 107, "metadata": {}, "outputs": [ { @@ -300,7 +335,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 108, "metadata": {}, "outputs": [ { @@ -344,15 +379,15 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 109, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "service/frontend created\r\n", - "deployment.apps/frontend created\r\n" + "service/frontend created\n", + "deployment.apps/frontend created\n" ] } ], @@ -369,15 +404,15 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 110, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\r\n", - "frontend LoadBalancer 10.96.29.88 80:31947/TCP 55s\r\n" + "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\r\n", + "frontend LoadBalancer 10.102.163.17 80:30601/TCP 0s\r\n" ] } ], @@ -417,15 +452,15 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 111, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "service/pos created\r\n", - "deployment.apps/pos created\r\n" + "service/pos created\n", + "deployment.apps/pos created\n" ] } ], @@ -442,7 +477,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 112, "metadata": {}, "outputs": [ { @@ -450,7 +485,7 @@ "output_type": "stream", "text": [ "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\r\n", - "pos NodePort 10.101.201.68 7777:30431/TCP 34s\r\n" + "pos NodePort 10.110.52.235 7777:30431/TCP 1s\r\n" ] } ], @@ -473,6 +508,158 @@ "The external value appears under 'PORT(S)'. It is after the '3000:' and before the '/TCP' portion of the string. Appending it to the public address of the Kubernetes cluster (or loadbalancer fronting the cluster) to access the Point-of-Sales app." ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Check that pods/services/deployments are running" + ] + }, + { + "cell_type": "code", + "execution_count": 113, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "NAMESPACE NAME READY STATUS RESTARTS AGE\r\n", + "cabpk-system pod/cabpk-controller-manager-7bf77b6ddb-lzprc 2/2 Running 85 178d\r\n", + "capd-system pod/capd-controller-manager-5cf7d47656-2zbf7 2/2 Running 91 178d\r\n", + "capi-system pod/capi-controller-manager-55b9d8ffc7-x96nt 1/1 Running 91 178d\r\n", + "default pod/cart-564f5c6c84-9qp8l 0/1 ContainerCreating 0 5s\r\n", + "default pod/cart-redis-78f644696b-f92rv 0/1 ContainerCreating 0 6s\r\n", + "default pod/catalog-6f4c978d85-4vtkb 0/1 ContainerCreating 0 4s\r\n", + "default pod/catalog-mongo-748f9c547b-tlzlh 0/1 ContainerCreating 0 5s\r\n", + "default pod/frontend-746bb69469-9mw6k 0/1 ContainerCreating 0 1s\r\n", + "default pod/order-d6fd9854b-rn6gm 0/1 ContainerCreating 0 3s\r\n", + "default pod/order-postgres-56bd5dcddd-xnfln 0/1 ContainerCreating 0 4s\r\n", + "default pod/payment-5644cddfb7-f6cl8 0/1 ContainerCreating 0 4s\r\n", + "default pod/pos-55c9d9d855-gxx45 0/1 ContainerCreating 0 0s\r\n", + "default pod/users-7d8485d99c-tlstl 0/1 ContainerCreating 0 1s\r\n", + "default pod/users-mongo-57869df5b5-q58gb 0/1 ContainerCreating 0 2s\r\n", + "default pod/users-redis-75b846d9db-rfpnr 0/1 ContainerCreating 0 2s\r\n", + "kube-system pod/coredns-fb8b8dccf-gwqtv 1/1 Running 68 178d\r\n", + "kube-system pod/coredns-fb8b8dccf-x6thq 1/1 Running 68 178d\r\n", + "kube-system pod/etcd-minikube 1/1 Running 2 178d\r\n", + "kube-system pod/kube-addon-manager-minikube 1/1 Running 2 178d\r\n", + "kube-system pod/kube-apiserver-minikube 1/1 Running 2 178d\r\n", + "kube-system pod/kube-controller-manager-minikube 1/1 Running 7 178d\r\n", + "kube-system pod/kube-proxy-mj8jg 1/1 Running 2 178d\r\n", + "kube-system pod/kube-scheduler-minikube 1/1 Running 8 178d\r\n", + "kube-system pod/storage-provisioner 1/1 Running 2 178d\r\n", + "kubernetes-dashboard pod/dashboard-metrics-scraper-5b4f756b59-d9427 1/1 Running 70 178d\r\n", + "kubernetes-dashboard pod/kubernetes-dashboard-556cc594db-mwmmn 1/1 Running 67 178d\r\n", + "\r\n", + "NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\r\n", + "cabpk-system service/cabpk-controller-manager-metrics-service ClusterIP 10.109.233.42 8443/TCP 178d\r\n", + "capd-system service/capd-controller-manager-metrics-service ClusterIP 10.102.181.22 8443/TCP 178d\r\n", + "default service/cart ClusterIP 10.97.231.107 5000/TCP 5s\r\n", + "default service/cart-redis ClusterIP 10.96.211.138 6379/TCP 6s\r\n", + "default service/catalog ClusterIP 10.110.169.35 8082/TCP 4s\r\n", + "default service/catalog-mongo ClusterIP 10.98.228.113 27017/TCP 5s\r\n", + "default service/frontend LoadBalancer 10.102.163.17 80:30601/TCP 1s\r\n", + "default service/kubernetes ClusterIP 10.96.0.1 443/TCP 178d\r\n", + "default service/order ClusterIP 10.104.11.183 6000/TCP 3s\r\n", + "default service/order-postgres ClusterIP 10.100.84.82 5432/TCP 4s\r\n", + "default service/payment ClusterIP 10.111.128.252 9000/TCP 4s\r\n", + "default service/pos NodePort 10.110.52.235 7777:30431/TCP 1s\r\n", + "default service/users ClusterIP 10.110.32.52 8083/TCP 1s\r\n", + "default service/users-mongo ClusterIP 10.111.227.3 27017/TCP 2s\r\n", + "default service/users-redis ClusterIP 10.96.79.94 6379/TCP 2s\r\n", + "kube-system service/kube-dns ClusterIP 10.96.0.10 53/UDP,53/TCP,9153/TCP 178d\r\n", + "kubernetes-dashboard service/dashboard-metrics-scraper ClusterIP 10.111.211.9 8000/TCP 178d\r\n", + "kubernetes-dashboard service/kubernetes-dashboard ClusterIP 10.104.196.129 80/TCP 178d\r\n", + "\r\n", + "NAMESPACE NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE\r\n", + "kube-system daemonset.apps/kube-proxy 1 1 1 1 1 178d\r\n", + "\r\n", + "NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE\r\n", + "cabpk-system deployment.apps/cabpk-controller-manager 1/1 1 1 178d\r\n", + "capd-system deployment.apps/capd-controller-manager 1/1 1 1 178d\r\n", + "capi-system deployment.apps/capi-controller-manager 1/1 1 1 178d\r\n", + "default deployment.apps/cart 0/1 1 0 5s\r\n", + "default deployment.apps/cart-redis 0/1 1 0 6s\r\n", + "default deployment.apps/catalog 0/1 1 0 4s\r\n", + "default deployment.apps/catalog-mongo 0/1 1 0 5s\r\n", + "default deployment.apps/frontend 0/1 1 0 1s\r\n", + "default deployment.apps/order 0/1 1 0 3s\r\n", + "default deployment.apps/order-postgres 0/1 1 0 4s\r\n", + "default deployment.apps/payment 0/1 1 0 4s\r\n", + "default deployment.apps/pos 0/1 1 0 0s\r\n", + "default deployment.apps/users 0/1 1 0 1s\r\n", + "default deployment.apps/users-mongo 0/1 1 0 2s\r\n", + "default deployment.apps/users-redis 0/1 1 0 2s\r\n", + "kube-system deployment.apps/coredns 2/2 2 2 178d\r\n", + "kubernetes-dashboard deployment.apps/dashboard-metrics-scraper 1/1 1 1 178d\r\n", + "kubernetes-dashboard deployment.apps/kubernetes-dashboard 1/1 1 1 178d\r\n", + "\r\n", + "NAMESPACE NAME DESIRED CURRENT READY AGE\r\n", + "cabpk-system replicaset.apps/cabpk-controller-manager-7bf77b6ddb 1 1 1 178d\r\n", + "capd-system replicaset.apps/capd-controller-manager-5cf7d47656 1 1 1 178d\r\n", + "capi-system replicaset.apps/capi-controller-manager-55b9d8ffc7 1 1 1 178d\r\n", + "default replicaset.apps/cart-564f5c6c84 1 1 0 5s\r\n", + "default replicaset.apps/cart-redis-78f644696b 1 1 0 6s\r\n", + "default replicaset.apps/catalog-6f4c978d85 1 1 0 4s\r\n", + "default replicaset.apps/catalog-mongo-748f9c547b 1 1 0 5s\r\n", + "default replicaset.apps/frontend-746bb69469 1 1 0 1s\r\n", + "default replicaset.apps/order-d6fd9854b 1 1 0 3s\r\n", + "default replicaset.apps/order-postgres-56bd5dcddd 1 1 0 4s\r\n", + "default replicaset.apps/payment-5644cddfb7 1 1 0 4s\r\n", + "default replicaset.apps/pos-55c9d9d855 1 1 0 0s\r\n", + "default replicaset.apps/users-7d8485d99c 1 1 0 1s\r\n", + "default replicaset.apps/users-mongo-57869df5b5 1 1 0 2s\r\n", + "default replicaset.apps/users-redis-75b846d9db 1 1 0 2s\r\n", + "kube-system replicaset.apps/coredns-fb8b8dccf 2 2 2 178d\r\n", + "kubernetes-dashboard replicaset.apps/dashboard-metrics-scraper-5b4f756b59 1 1 1 178d\r\n", + "kubernetes-dashboard replicaset.apps/kubernetes-dashboard-556cc594db 1 1 1 178d\r\n" + ] + } + ], + "source": [ + "!kubectl get all -A" + ] + }, + { + "cell_type": "code", + "execution_count": 114, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "|----------------------|------------------------------------------|----------------------------|-----|\r\n", + "| NAMESPACE | NAME | TARGET PORT | URL |\r\n", + "|----------------------|------------------------------------------|----------------------------|-----|\r\n", + "| cabpk-system | cabpk-controller-manager-metrics-service | No node port |\r\n", + "| capd-system | capd-controller-manager-metrics-service | No node port |\r\n", + "| default | cart | No node port |\r\n", + "| default | cart-redis | No node port |\r\n", + "| default | catalog | No node port |\r\n", + "| default | catalog-mongo | No node port |\r\n", + "| default | frontend | http://172.16.39.211:30601 |\r\n", + "| default | kubernetes | No node port |\r\n", + "| default | order | No node port |\r\n", + "| default | order-postgres | No node port |\r\n", + "| default | payment | No node port |\r\n", + "| default | pos | http://172.16.39.211:30431 |\r\n", + "| default | users | No node port |\r\n", + "| default | users-mongo | No node port |\r\n", + "| default | users-redis | No node port |\r\n", + "| kube-system | kube-dns | No node port |\r\n", + "| kubernetes-dashboard | dashboard-metrics-scraper | No node port |\r\n", + "| kubernetes-dashboard | kubernetes-dashboard | No node port |\r\n", + "|----------------------|------------------------------------------|----------------------------|-----|\r\n" + ] + } + ], + "source": [ + "#if using minikube you can use the target port url \n", + "!minikube service list" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -487,6 +674,120 @@ "\n", "It is strongly recommended that the `JAEGER_AGENT_PORT` values not be modified as the tracing library implementations for specific languages favor certain ports." ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Cleanup\n" + ] + }, + { + "cell_type": "code", + "execution_count": 115, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "service \"pos\" deleted\n", + "deployment.apps \"pos\" deleted\n", + "service \"frontend\" deleted\n", + "deployment.apps \"frontend\" deleted\n", + "service \"users-mongo\" deleted\n", + "deployment.apps \"users-mongo\" deleted\n", + "service \"users-redis\" deleted\n", + "deployment.apps \"users-redis\" deleted\n", + "service \"users\" deleted\n", + "deployment.apps \"users\" deleted\n", + "configmap \"users-initdb-config\" deleted\n", + "secret \"users-mongo-pass\" deleted\n", + "secret \"users-redis-pass\" deleted\n", + "service \"order-postgres\" deleted\n", + "deployment.apps \"order-postgres\" deleted\n", + "service \"order\" deleted\n", + "deployment.apps \"order\" deleted\n", + "secret \"order-postgres-pass\" deleted\n", + "service \"payment\" deleted\n", + "deployment.apps \"payment\" deleted\n", + "service \"catalog-mongo\" deleted\n", + "deployment.apps \"catalog-mongo\" deleted\n", + "service \"catalog\" deleted\n", + "deployment.apps \"catalog\" deleted\n", + "configmap \"catalog-initdb-config\" deleted\n", + "secret \"catalog-mongo-pass\" deleted\n", + "service \"cart-redis\" deleted\n", + "deployment.apps \"cart-redis\" deleted\n", + "service \"cart\" deleted\n", + "deployment.apps \"cart\" deleted\n", + "secret \"cart-redis-pass\" deleted\n" + ] + } + ], + "source": [ + "#bulk delete of all deployments/services/pods/secrets in reverse order\n", + "!kubectl delete -f point-of-sales-total.yaml\n", + "!kubectl delete -f frontend-total.yaml\n", + "!kubectl delete -f users-db-total.yaml\n", + "!kubectl delete -f users-redis-total.yaml\n", + "!kubectl delete -f users-total.yaml\n", + "!kubectl delete -f users-db-initdb-configmap.yaml\n", + "!kubectl delete secret users-mongo-pass \n", + "!kubectl delete secret users-redis-pass \n", + "!kubectl delete -f order-db-total.yaml\n", + "!kubectl delete -f order-total.yaml\n", + "!kubectl delete secret order-postgres-pass \n", + "!kubectl delete -f payment-total.yaml\n", + "!kubectl delete -f catalog-db-total.yaml\n", + "!kubectl delete -f catalog-total.yaml\n", + "!kubectl delete -f catalog-db-initdb-configmap.yaml\n", + "!kubectl delete secret catalog-mongo-pass\n", + "!kubectl delete -f cart-redis-total.yaml\n", + "!kubectl delete -f cart-total.yaml\n", + "!kubectl delete secret cart-redis-pass " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Check that the pods/services were deleted" + ] + }, + { + "cell_type": "code", + "execution_count": 118, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "NAME READY STATUS RESTARTS AGE\r\n", + "pod/cart-564f5c6c84-9qp8l 1/1 Terminating 0 50s\r\n", + "pod/catalog-6f4c978d85-4vtkb 1/1 Terminating 0 49s\r\n", + "pod/frontend-746bb69469-9mw6k 0/1 Terminating 0 46s\r\n", + "pod/order-d6fd9854b-rn6gm 0/1 Terminating 0 48s\r\n", + "pod/order-postgres-56bd5dcddd-xnfln 0/1 Terminating 0 49s\r\n", + "pod/users-7d8485d99c-tlstl 0/1 Terminating 0 46s\r\n", + "pod/users-mongo-57869df5b5-q58gb 0/1 Terminating 0 47s\r\n", + "\r\n", + "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\r\n", + "service/kubernetes ClusterIP 10.96.0.1 443/TCP 178d\r\n" + ] + } + ], + "source": [ + "!kubectl get all" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { From 66858ab73f2894346b08c87bfd10579ecb760c02 Mon Sep 17 00:00:00 2001 From: mferratt Date: Tue, 12 May 2020 17:05:28 -0700 Subject: [PATCH 4/4] Update README.md added a link for the jupyter notebook of the k8s deployment --- kubernetes-manifests/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kubernetes-manifests/README.md b/kubernetes-manifests/README.md index 0a11fd74..4496d7ab 100644 --- a/kubernetes-manifests/README.md +++ b/kubernetes-manifests/README.md @@ -8,6 +8,8 @@ This app is developed by team behind www.cloudjourney.io The current version of the application passes JSON Web Tokens (JWT) for authentication on certain API calls. The application will not work as expected if the `users` service is not present to issue / authenticate these tokens. +Optionally, you may use the Jupyter Notebook located here https://github.com/vmwarecloudadvocacy/acme_fitness_demo/blob/master/kubernetes-manifests/acmefit-notebook.ipynb + ## Datastore Dependent Services This section covers the deployment of the datastore dependent microservices. It is recommended to deploy these services first.