Pas Apicella

Information on Pivotal Cloud Foundry (PAS/PKS/PFS) - Continuously deliver any app to every major private and public cloud with a single platformPas Apicellahttp://www.blogger.com/profile/09389663166398991762noreply@blogger.comBlogger426125
Updated: 3 days 9 hours ago
k8s info: VMware Tanzu Octant - A web-based, highly extensible platform for developers to better understand the complexity of Kubernetes clusters
Octant is a tool for developers to understand how applications run on a Kubernetes cluster. It aims to be part of the developer's toolkit for gaining insight and approaching complexity found in Kubernetes. Octant offers a combination of introspective tooling, cluster navigation, and object management along with a plugin system to further extend its capabilities
So how would I install this?
1. First on my k8s cluster lets create a deployment and a service. You can skip this step if you already have workloads on your cluster. These commands will work on any cluster as the image exists on DockerHub itself so as long as you can get to DockerHub these kubectl commands will work.
$ kubectl run pbs-demo --image=pasapples/pbs-demo-image --replicas=2 --port=8080
$ kubectl expose deploy pbs-demo --type=LoadBalancer --port=80 --target-port=8080
$ http http://101.195.48.144/customers/1
HTTP/1.1 200
Content-Type: application/hal+json;charset=UTF-8
Date: Tue, 03 Dec 2019 16:11:54 GMT
Transfer-Encoding: chunked
{
"_links": {
"customer": {
"href": "http://101.195.48.144/customers/1"
},
"self": {
"href": "http://101.195.48.144/customers/1"
}
},
"name": "pas",
"status": "active"
}
2. To install Octant you can view instructions on the GitHub page as follows
https://github.com/vmware-tanzu/octant
Given I am on a Mac it's installed using brew as shown below. For other OS refer to link above
$ brew install octant
3. Thats it you can now launch the UI as shown below.
$ octant
2019-12-03T21:47:56.271+0530 INFO module/manager.go:79 registering action {"component": "module-manager", "actionPath": "deployment/configuration", "module-name": "overview"}
2019-12-03T21:47:56.271+0530 INFO module/manager.go:79 registering action {"component": "module-manager", "actionPath": "overview/containerEditor", "module-name": "overview"}
2019-12-03T21:47:56.271+0530 INFO module/manager.go:79 registering action {"component": "module-manager", "actionPath": "overview/serviceEditor", "module-name": "overview"}
2019-12-03T21:47:56.271+0530 INFO module/manager.go:79 registering action {"component": "module-manager", "actionPath": "octant/deleteObject", "module-name": "configuration"}
2019-12-03T21:47:56.272+0530 INFO dash/dash.go:370 Using embedded Octant frontend
2019-12-03T21:47:56.277+0530 INFO dash/dash.go:349 Dashboard is available at http://127.0.0.1:7777
Octant should immediately launch your default web browser on 127.0.0.1:7777
And to view our deployed application!!!!
It's a nice UI and it even has the ability to switch to a different k8s context from the menu bar itself
More Information
1. Seeing is Believing: Octant Reveals the Objects Running in Kubernetes Clusters
https://blogs.vmware.com/cloudnative/2019/08/12/octant-reveals-objects-running-in-kubernetes-clusters/
2. GitHub project page
https://github.com/vmware-tanzu/octant
So how would I install this?
1. First on my k8s cluster lets create a deployment and a service. You can skip this step if you already have workloads on your cluster. These commands will work on any cluster as the image exists on DockerHub itself so as long as you can get to DockerHub these kubectl commands will work.
$ kubectl run pbs-demo --image=pasapples/pbs-demo-image --replicas=2 --port=8080
$ kubectl expose deploy pbs-demo --type=LoadBalancer --port=80 --target-port=8080
$ http http://101.195.48.144/customers/1
HTTP/1.1 200
Content-Type: application/hal+json;charset=UTF-8
Date: Tue, 03 Dec 2019 16:11:54 GMT
Transfer-Encoding: chunked
{
"_links": {
"customer": {
"href": "http://101.195.48.144/customers/1"
},
"self": {
"href": "http://101.195.48.144/customers/1"
}
},
"name": "pas",
"status": "active"
}
2. To install Octant you can view instructions on the GitHub page as follows
https://github.com/vmware-tanzu/octant
Given I am on a Mac it's installed using brew as shown below. For other OS refer to link above
$ brew install octant
3. Thats it you can now launch the UI as shown below.
$ octant
2019-12-03T21:47:56.271+0530 INFO module/manager.go:79 registering action {"component": "module-manager", "actionPath": "deployment/configuration", "module-name": "overview"}
2019-12-03T21:47:56.271+0530 INFO module/manager.go:79 registering action {"component": "module-manager", "actionPath": "overview/containerEditor", "module-name": "overview"}
2019-12-03T21:47:56.271+0530 INFO module/manager.go:79 registering action {"component": "module-manager", "actionPath": "overview/serviceEditor", "module-name": "overview"}
2019-12-03T21:47:56.271+0530 INFO module/manager.go:79 registering action {"component": "module-manager", "actionPath": "octant/deleteObject", "module-name": "configuration"}
2019-12-03T21:47:56.272+0530 INFO dash/dash.go:370 Using embedded Octant frontend
2019-12-03T21:47:56.277+0530 INFO dash/dash.go:349 Dashboard is available at http://127.0.0.1:7777
Octant should immediately launch your default web browser on 127.0.0.1:7777
And to view our deployed application!!!!
It's a nice UI and it even has the ability to switch to a different k8s context from the menu bar itself
More Information
1. Seeing is Believing: Octant Reveals the Objects Running in Kubernetes Clusters
https://blogs.vmware.com/cloudnative/2019/08/12/octant-reveals-objects-running-in-kubernetes-clusters/
2. GitHub project page
https://github.com/vmware-tanzu/octant
Categories: Fusion Middleware
k8s info: kubectx and kubens to the rescue
kubectx is a utility to manage and switch between kubectl(1) contexts. To me this is so handy I can't live without it. I am constantly using k8s everywhere from PKS (Pivotal Container Service) clusters, GKE clusters, minikube and wherever I can get my hands on a cluster.
So when I heard about kubectx and no I can't live with this and it makes my life so much easier. His how
Where is my current k8s context and potentially what other contexts could I switch to?
Ok so I am in the k8s cluster with the context of "apples". Let's switch to "lemons" then
It's really as simple as that. In my world every k8s cluster is named after a FRUIT.
Finally if you wish to set the correct context namespace you can use "kubens" to do that just as easily as shown below
More Information
https://github.com/ahmetb/kubectx
https://formulae.brew.sh/formula/kubectx
So when I heard about kubectx and no I can't live with this and it makes my life so much easier. His how
Where is my current k8s context and potentially what other contexts could I switch to?
Ok so I am in the k8s cluster with the context of "apples". Let's switch to "lemons" then
It's really as simple as that. In my world every k8s cluster is named after a FRUIT.
Finally if you wish to set the correct context namespace you can use "kubens" to do that just as easily as shown below
More Information
https://github.com/ahmetb/kubectx
https://formulae.brew.sh/formula/kubectx
Categories: Fusion Middleware
Joined the ranks of the 100+ CKA/CKAD certified Pivotal Platform Architects
I am now officially CKAD certified in fact I am Cloud Foundry certified as well. Great to be certified with the leaders in container technology both with PaaS and CaaS.
Categories: Fusion Middleware
Getting started with Pivotal Telemetry Collector
Pivotal Telemetry Collector is an automated tool that collects data from a series of Pivotal Cloud Foundry (PCF) APIs found within a foundation and securely sends that data to Pivotal. The tool collects:
Pivotal uses this information to do the following:
1. Download the scripts required to run "Pivotal Telemetry Collector" using this URL from Pivotal Network
https://network.pivotal.io/products/pivotal-telemetry-collector/
2. Extract to file system. You will notice 3 executables use the right one for your OS, in my case it was the Mac OSX executable "telemetry-collector-darwin-amd64"
-rwxr-xr-x 1 papicella staff 14877449 5 Oct 00:42 telemetry-collector-linux-amd64*
-rwxr-xr-x 1 papicella staff 14771312 5 Oct 00:42 telemetry-collector-darwin-amd64*
-rwxr-xr-x 1 papicella staff 14447104 5 Oct 00:42 telemetry-collector-windows-amd64.exe*
3. Make sure you have network access to your PCF env. You will need to hit the Operations Manager URL as well as the CF CLI API and usage service API endpoints as shown below
Ops Manager endpoint
$ ping opsmgr-02.haas-yyy.pez.pivotal.io
PING opsmgr-02.haas-yyy.pez.pivotal.io (10.195.1.1): 56 data bytes
64 bytes from 10.195.1.1: icmp_seq=0 ttl=58 time=338.412 ms
CF API endpoint
$ ping api.system.run.haas-yyy.pez.pivotal.io
PING api.system.run.haas-yyy.pez.pivotal.io (10.195.1.2): 56 data bytes
64 bytes from 10.195.1.2: icmp_seq=0 ttl=58 time=380.852 ms
Usage Service API endpoint
$ ping app-usage.system.run.haas-yyy.pez.pivotal.io
PING app-usage.system.run.haas-yyy.pez.pivotal.io (10.195.1.3): 56 data bytes
64 bytes from 10.195.1.3: icmp_seq=0 ttl=58 time=495.996 ms
4. Now you can use this via two options. As you would of guessed we are using the CLI given we have downloaded the scripts.
Concourse: https://docs.pivotal.io/telemetry/1-1/using-concourse.html
CLI: https://docs.pivotal.io/telemetry/1-1/using-cli.html
5. So to run out first collect we would run the collector script as follows. More information about what the CLI options are can be found on this link or using help option "./telemetry-collector-darwin-amd64 --help"
https://docs.pivotal.io/telemetry/1-1/using-cli.html
Script Name: run-with-usage.sh
$ ./telemetry-collector-darwin-amd64 collect --url https://opsmgr-02.haas-yyy.pez.pivotal.io/ --username admin --password {PASSWD} --env-type production --output-dir output --usage-service-url https://app-usage.system.run.haas-yyy.pez.pivotal.io/ --usage-service-client-id push_usage_service --usage-service-client-secret {PUSH-USAGE-SERVICE-PASSWORD} --usage-service-insecure-skip-tls-verify --insecure-skip-tls-verify --cf-api-url https://api.system.run.haas-yyy.pez.pivotal.io
Note: You would obtain the PUSH-USAGE-SERVICE-PASSWORD from Ops Manager PAS tile credentials tab as shown in screen shot below
6. All set let's try it out
$ ./run-with-usage.sh
Collecting data from Operations Manager at https://opsmgr-02.haas-yyy.pez.pivotal.io/
Collecting data from Usage Service at https://app-usage.system.run.haas-yyy.pez.pivotal.io/
Wrote output to output/FoundationDetails_1571355194.tar
Success!
7. Let's extract the output TAR as follows
$ cd output/
$ tar -xvf FoundationDetails_1571355194.tar
x opsmanager/ops_manager_deployed_products
x opsmanager/pivotal-container-service_resources
x opsmanager/pivotal-container-service_properties
x opsmanager/pivotal-mysql_resources
x opsmanager/pivotal-mysql_properties
x opsmanager/cf_resources
x opsmanager/cf_properties
x opsmanager/p-compliance-scanner_resources
x opsmanager/p-compliance-scanner_properties
x opsmanager/ops_manager_vm_types
x opsmanager/ops_manager_diagnostic_report
x opsmanager/ops_manager_installations
x opsmanager/ops_manager_certificates
x opsmanager/ops_manager_certificate_authorities
x opsmanager/metadata
x usage_service/app_usage
x usage_service/service_usage
x usage_service/task_usage
x usage_service/metadata
7. Now let's view the output which is a SET of JSON files and to do that I simply use "cat" command and pipe that to JQ as shown below
$ cat ./output/opsmanager/ops_manager_installations | jq -r
{
"installations": [
{
"additions": [
{
"change_type": "addition",
"deployment_status": "successful",
"guid": "p-compliance-scanner-a53448be03a372a13d89",
"identifier": "p-compliance-scanner",
"label": "Compliance Scanner for PCF",
"product_version": "1.0.0"
}
],
"deletions": [],
"finished_at": "2019-08-30T09:38:29.679Z",
"id": 25,
"started_at": "2019-08-30T09:21:44.810Z",
"status": "failed",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": []
},
{
"additions": [],
"deletions": [
{
"change_type": "deletion",
"deployment_status": "pending",
"guid": "p-compliance-scanner-1905a6707e4f434e315a",
"identifier": "p-compliance-scanner",
"label": "Compliance Scanner for PCF",
"product_version": "1.0.0-beta.25"
}
],
"finished_at": "2019-08-08T02:10:51.130Z",
"id": 24,
"started_at": "2019-08-08T02:09:10.290Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-07-18T12:27:54.301Z",
"id": 23,
"started_at": "2019-07-18T11:31:19.781Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": [
{
"change_type": "update",
"deployment_status": "successful",
"guid": "cf-3095a0a264aa5900d79f",
"identifier": "cf",
"label": "Small Footprint PAS",
"product_version": "2.5.3"
}
]
},
{
"additions": [],
"deletions": [
{
"change_type": "deletion",
"deployment_status": "pending",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
],
"finished_at": "2019-07-07T00:16:31.948Z",
"id": 22,
"started_at": "2019-07-07T00:04:32.974Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-07-07T00:02:12.003Z",
"id": 21,
"started_at": "2019-07-06T23:57:06.401Z",
"status": "failed",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": [
{
"change_type": "update",
"deployment_status": "failed",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
]
},
{
"additions": [
{
"change_type": "addition",
"deployment_status": "successful",
"guid": "p-compliance-scanner-1905a6707e4f434e315a",
"identifier": "p-compliance-scanner",
"label": "Compliance Scanner for PCF",
"product_version": "1.0.0-beta.25"
}
],
"deletions": [],
"finished_at": "2019-06-10T09:23:19.595Z",
"id": 20,
"started_at": "2019-06-10T09:10:44.431Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": []
},
{
"additions": [
{
"change_type": "addition",
"deployment_status": "skipped",
"guid": "aquasec-1b94477ae275ee81be58",
"identifier": "aquasec",
"label": "Aqua Security for PCF",
"product_version": "1.0.0"
}
],
"deletions": [],
"finished_at": "2019-06-06T17:38:18.396Z",
"id": 19,
"started_at": "2019-06-06T17:35:34.614Z",
"status": "failed",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": []
},
{
"additions": [
{
"change_type": "addition",
"deployment_status": "skipped",
"guid": "aquasec-1b94477ae275ee81be58",
"identifier": "aquasec",
"label": "Aqua Security for PCF",
"product_version": "1.0.0"
}
],
"deletions": [],
"finished_at": "2019-06-06T17:33:18.545Z",
"id": 18,
"started_at": "2019-06-06T17:21:41.529Z",
"status": "failed",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
},
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-06-04T11:15:43.546Z",
"id": 17,
"started_at": "2019-06-04T10:49:57.969Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
},
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-06-04T10:44:04.018Z",
"id": 16,
"started_at": "2019-06-04T10:17:28.230Z",
"status": "failed",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
},
{
"change_type": "unchanged",
"deployment_status": "failed",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-06-04T09:52:30.782Z",
"id": 15,
"started_at": "2019-06-04T09:48:45.867Z",
"status": "failed",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
},
{
"change_type": "unchanged",
"deployment_status": "failed",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-06-04T09:21:17.245Z",
"id": 14,
"started_at": "2019-06-04T09:17:45.360Z",
"status": "failed",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
},
{
"change_type": "unchanged",
"deployment_status": "failed",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-06-04T08:50:33.333Z",
"id": 13,
"started_at": "2019-06-04T08:47:09.790Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
},
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-06-04T08:32:44.772Z",
"id": 12,
"started_at": "2019-06-04T08:23:27.386Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
},
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-06-04T08:16:41.757Z",
"id": 11,
"started_at": "2019-06-04T08:13:54.645Z",
"status": "failed",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
},
{
"change_type": "unchanged",
"deployment_status": "failed",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-06-04T01:53:50.594Z",
"id": 10,
"started_at": "2019-06-04T01:43:56.205Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": [
{
"change_type": "update",
"deployment_status": "successful",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
]
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-06-04T01:28:22.975Z",
"id": 9,
"started_at": "2019-06-04T01:24:52.587Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
},
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-06-03T08:37:25.961Z",
"id": 8,
"started_at": "2019-06-03T08:13:07.511Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": [
{
"change_type": "update",
"deployment_status": "successful",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
]
},
{
"additions": [
{
"change_type": "addition",
"deployment_status": "successful",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
],
"deletions": [],
"finished_at": "2019-06-03T04:57:06.897Z",
"id": 7,
"started_at": "2019-06-03T03:52:13.705Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": []
},
{
"additions": [
{
"change_type": "addition",
"deployment_status": "successful",
"guid": "pivotal-mysql-0e5d717f1c87c8095c9d",
"identifier": "pivotal-mysql",
"label": "MySQL for Pivotal Cloud Foundry v2",
"product_version": "2.5.4-build.51"
}
],
"deletions": [],
"finished_at": "2019-05-22T05:15:55.703Z",
"id": 6,
"started_at": "2019-05-22T04:09:49.841Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
},
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "cf-3095a0a264aa5900d79f",
"identifier": "cf",
"label": "Small Footprint PAS",
"product_version": "2.5.3"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-05-22T02:12:22.934Z",
"id": 5,
"started_at": "2019-05-22T01:45:28.101Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
},
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "cf-3095a0a264aa5900d79f",
"identifier": "cf",
"label": "Small Footprint PAS",
"product_version": "2.5.3"
}
],
"updates": []
},
{
"additions": [
{
"change_type": "addition",
"deployment_status": "failed",
"guid": "cf-3095a0a264aa5900d79f",
"identifier": "cf",
"label": "Small Footprint PAS",
"product_version": "2.5.3"
}
],
"deletions": [],
"finished_at": "2019-05-22T00:23:29.844Z",
"id": 4,
"started_at": "2019-05-21T23:16:42.418Z",
"status": "failed",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-05-16T01:50:50.640Z",
"id": 3,
"started_at": "2019-05-16T01:45:22.438Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": [
{
"change_type": "update",
"deployment_status": "successful",
"guid": "pivotal-container-service-5c28f63410227c2221c8",
"identifier": "pivotal-container-service",
"label": "Enterprise PKS",
"product_version": "1.4.0-build.31"
}
]
},
{
"additions": [
{
"change_type": "addition",
"deployment_status": "successful",
"guid": "pivotal-container-service-5c28f63410227c2221c8",
"identifier": "pivotal-container-service",
"label": "Enterprise PKS",
"product_version": "1.4.0-build.31"
}
],
"deletions": [],
"finished_at": "2019-05-15T00:08:32.241Z",
"id": 2,
"started_at": "2019-05-14T23:33:58.105Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": []
},
{
"additions": [
{
"change_type": "addition",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"deletions": [],
"finished_at": "2019-05-14T23:29:47.525Z",
"id": 1,
"started_at": "2019-05-14T23:13:13.244Z",
"status": "succeeded",
"unchanged": [],
"updates": []
}
]
}
Optionally you should send this TAR file output on every ticket/case your create so support has a great snapshot of what your ENV looks like to help diagnose support issues for you.
telemetry-collector send --path --api-key
For the API-KEY please contact your Pivotal AE or Platform Architect to request that as the Telemetry team issues API key to customer's
More Information
https://docs.pivotal.io/telemetry/1-1/index.html
- Configuration data from the Ops Manager API.
- Optional certificate data from the CredHub API.
- Optional app, task and service instance usage data from the Usage Service API.
Pivotal uses this information to do the following:
- Improve its products and services.
- Fix problems.
- Advise customers on how best to deploy and use Pivotal products.
- Provide better customer support.
1. Download the scripts required to run "Pivotal Telemetry Collector" using this URL from Pivotal Network
https://network.pivotal.io/products/pivotal-telemetry-collector/
2. Extract to file system. You will notice 3 executables use the right one for your OS, in my case it was the Mac OSX executable "telemetry-collector-darwin-amd64"
-rwxr-xr-x 1 papicella staff 14877449 5 Oct 00:42 telemetry-collector-linux-amd64*
-rwxr-xr-x 1 papicella staff 14771312 5 Oct 00:42 telemetry-collector-darwin-amd64*
-rwxr-xr-x 1 papicella staff 14447104 5 Oct 00:42 telemetry-collector-windows-amd64.exe*
3. Make sure you have network access to your PCF env. You will need to hit the Operations Manager URL as well as the CF CLI API and usage service API endpoints as shown below
Ops Manager endpoint
$ ping opsmgr-02.haas-yyy.pez.pivotal.io
PING opsmgr-02.haas-yyy.pez.pivotal.io (10.195.1.1): 56 data bytes
64 bytes from 10.195.1.1: icmp_seq=0 ttl=58 time=338.412 ms
CF API endpoint
$ ping api.system.run.haas-yyy.pez.pivotal.io
PING api.system.run.haas-yyy.pez.pivotal.io (10.195.1.2): 56 data bytes
64 bytes from 10.195.1.2: icmp_seq=0 ttl=58 time=380.852 ms
Usage Service API endpoint
$ ping app-usage.system.run.haas-yyy.pez.pivotal.io
PING app-usage.system.run.haas-yyy.pez.pivotal.io (10.195.1.3): 56 data bytes
64 bytes from 10.195.1.3: icmp_seq=0 ttl=58 time=495.996 ms
4. Now you can use this via two options. As you would of guessed we are using the CLI given we have downloaded the scripts.
Concourse: https://docs.pivotal.io/telemetry/1-1/using-concourse.html
CLI: https://docs.pivotal.io/telemetry/1-1/using-cli.html
5. So to run out first collect we would run the collector script as follows. More information about what the CLI options are can be found on this link or using help option "./telemetry-collector-darwin-amd64 --help"
https://docs.pivotal.io/telemetry/1-1/using-cli.html
Script Name: run-with-usage.sh
$ ./telemetry-collector-darwin-amd64 collect --url https://opsmgr-02.haas-yyy.pez.pivotal.io/ --username admin --password {PASSWD} --env-type production --output-dir output --usage-service-url https://app-usage.system.run.haas-yyy.pez.pivotal.io/ --usage-service-client-id push_usage_service --usage-service-client-secret {PUSH-USAGE-SERVICE-PASSWORD} --usage-service-insecure-skip-tls-verify --insecure-skip-tls-verify --cf-api-url https://api.system.run.haas-yyy.pez.pivotal.io
Note: You would obtain the PUSH-USAGE-SERVICE-PASSWORD from Ops Manager PAS tile credentials tab as shown in screen shot below
6. All set let's try it out
$ ./run-with-usage.sh
Collecting data from Operations Manager at https://opsmgr-02.haas-yyy.pez.pivotal.io/
Collecting data from Usage Service at https://app-usage.system.run.haas-yyy.pez.pivotal.io/
Wrote output to output/FoundationDetails_1571355194.tar
Success!
7. Let's extract the output TAR as follows
$ cd output/
$ tar -xvf FoundationDetails_1571355194.tar
x opsmanager/ops_manager_deployed_products
x opsmanager/pivotal-container-service_resources
x opsmanager/pivotal-container-service_properties
x opsmanager/pivotal-mysql_resources
x opsmanager/pivotal-mysql_properties
x opsmanager/cf_resources
x opsmanager/cf_properties
x opsmanager/p-compliance-scanner_resources
x opsmanager/p-compliance-scanner_properties
x opsmanager/ops_manager_vm_types
x opsmanager/ops_manager_diagnostic_report
x opsmanager/ops_manager_installations
x opsmanager/ops_manager_certificates
x opsmanager/ops_manager_certificate_authorities
x opsmanager/metadata
x usage_service/app_usage
x usage_service/service_usage
x usage_service/task_usage
x usage_service/metadata
7. Now let's view the output which is a SET of JSON files and to do that I simply use "cat" command and pipe that to JQ as shown below
$ cat ./output/opsmanager/ops_manager_installations | jq -r
{
"installations": [
{
"additions": [
{
"change_type": "addition",
"deployment_status": "successful",
"guid": "p-compliance-scanner-a53448be03a372a13d89",
"identifier": "p-compliance-scanner",
"label": "Compliance Scanner for PCF",
"product_version": "1.0.0"
}
],
"deletions": [],
"finished_at": "2019-08-30T09:38:29.679Z",
"id": 25,
"started_at": "2019-08-30T09:21:44.810Z",
"status": "failed",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": []
},
{
"additions": [],
"deletions": [
{
"change_type": "deletion",
"deployment_status": "pending",
"guid": "p-compliance-scanner-1905a6707e4f434e315a",
"identifier": "p-compliance-scanner",
"label": "Compliance Scanner for PCF",
"product_version": "1.0.0-beta.25"
}
],
"finished_at": "2019-08-08T02:10:51.130Z",
"id": 24,
"started_at": "2019-08-08T02:09:10.290Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-07-18T12:27:54.301Z",
"id": 23,
"started_at": "2019-07-18T11:31:19.781Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": [
{
"change_type": "update",
"deployment_status": "successful",
"guid": "cf-3095a0a264aa5900d79f",
"identifier": "cf",
"label": "Small Footprint PAS",
"product_version": "2.5.3"
}
]
},
{
"additions": [],
"deletions": [
{
"change_type": "deletion",
"deployment_status": "pending",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
],
"finished_at": "2019-07-07T00:16:31.948Z",
"id": 22,
"started_at": "2019-07-07T00:04:32.974Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-07-07T00:02:12.003Z",
"id": 21,
"started_at": "2019-07-06T23:57:06.401Z",
"status": "failed",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": [
{
"change_type": "update",
"deployment_status": "failed",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
]
},
{
"additions": [
{
"change_type": "addition",
"deployment_status": "successful",
"guid": "p-compliance-scanner-1905a6707e4f434e315a",
"identifier": "p-compliance-scanner",
"label": "Compliance Scanner for PCF",
"product_version": "1.0.0-beta.25"
}
],
"deletions": [],
"finished_at": "2019-06-10T09:23:19.595Z",
"id": 20,
"started_at": "2019-06-10T09:10:44.431Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": []
},
{
"additions": [
{
"change_type": "addition",
"deployment_status": "skipped",
"guid": "aquasec-1b94477ae275ee81be58",
"identifier": "aquasec",
"label": "Aqua Security for PCF",
"product_version": "1.0.0"
}
],
"deletions": [],
"finished_at": "2019-06-06T17:38:18.396Z",
"id": 19,
"started_at": "2019-06-06T17:35:34.614Z",
"status": "failed",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": []
},
{
"additions": [
{
"change_type": "addition",
"deployment_status": "skipped",
"guid": "aquasec-1b94477ae275ee81be58",
"identifier": "aquasec",
"label": "Aqua Security for PCF",
"product_version": "1.0.0"
}
],
"deletions": [],
"finished_at": "2019-06-06T17:33:18.545Z",
"id": 18,
"started_at": "2019-06-06T17:21:41.529Z",
"status": "failed",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
},
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-06-04T11:15:43.546Z",
"id": 17,
"started_at": "2019-06-04T10:49:57.969Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
},
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-06-04T10:44:04.018Z",
"id": 16,
"started_at": "2019-06-04T10:17:28.230Z",
"status": "failed",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
},
{
"change_type": "unchanged",
"deployment_status": "failed",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-06-04T09:52:30.782Z",
"id": 15,
"started_at": "2019-06-04T09:48:45.867Z",
"status": "failed",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
},
{
"change_type": "unchanged",
"deployment_status": "failed",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-06-04T09:21:17.245Z",
"id": 14,
"started_at": "2019-06-04T09:17:45.360Z",
"status": "failed",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
},
{
"change_type": "unchanged",
"deployment_status": "failed",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-06-04T08:50:33.333Z",
"id": 13,
"started_at": "2019-06-04T08:47:09.790Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
},
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-06-04T08:32:44.772Z",
"id": 12,
"started_at": "2019-06-04T08:23:27.386Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
},
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-06-04T08:16:41.757Z",
"id": 11,
"started_at": "2019-06-04T08:13:54.645Z",
"status": "failed",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
},
{
"change_type": "unchanged",
"deployment_status": "failed",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-06-04T01:53:50.594Z",
"id": 10,
"started_at": "2019-06-04T01:43:56.205Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": [
{
"change_type": "update",
"deployment_status": "successful",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
]
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-06-04T01:28:22.975Z",
"id": 9,
"started_at": "2019-06-04T01:24:52.587Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
},
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-06-03T08:37:25.961Z",
"id": 8,
"started_at": "2019-06-03T08:13:07.511Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": [
{
"change_type": "update",
"deployment_status": "successful",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
]
},
{
"additions": [
{
"change_type": "addition",
"deployment_status": "successful",
"guid": "pas-windows-72031f60ab052fa4d473",
"identifier": "pas-windows",
"label": "Pivotal Application Service for Windows",
"product_version": "2.5.2"
}
],
"deletions": [],
"finished_at": "2019-06-03T04:57:06.897Z",
"id": 7,
"started_at": "2019-06-03T03:52:13.705Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": []
},
{
"additions": [
{
"change_type": "addition",
"deployment_status": "successful",
"guid": "pivotal-mysql-0e5d717f1c87c8095c9d",
"identifier": "pivotal-mysql",
"label": "MySQL for Pivotal Cloud Foundry v2",
"product_version": "2.5.4-build.51"
}
],
"deletions": [],
"finished_at": "2019-05-22T05:15:55.703Z",
"id": 6,
"started_at": "2019-05-22T04:09:49.841Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
},
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "cf-3095a0a264aa5900d79f",
"identifier": "cf",
"label": "Small Footprint PAS",
"product_version": "2.5.3"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-05-22T02:12:22.934Z",
"id": 5,
"started_at": "2019-05-22T01:45:28.101Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
},
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "cf-3095a0a264aa5900d79f",
"identifier": "cf",
"label": "Small Footprint PAS",
"product_version": "2.5.3"
}
],
"updates": []
},
{
"additions": [
{
"change_type": "addition",
"deployment_status": "failed",
"guid": "cf-3095a0a264aa5900d79f",
"identifier": "cf",
"label": "Small Footprint PAS",
"product_version": "2.5.3"
}
],
"deletions": [],
"finished_at": "2019-05-22T00:23:29.844Z",
"id": 4,
"started_at": "2019-05-21T23:16:42.418Z",
"status": "failed",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": []
},
{
"additions": [],
"deletions": [],
"finished_at": "2019-05-16T01:50:50.640Z",
"id": 3,
"started_at": "2019-05-16T01:45:22.438Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": [
{
"change_type": "update",
"deployment_status": "successful",
"guid": "pivotal-container-service-5c28f63410227c2221c8",
"identifier": "pivotal-container-service",
"label": "Enterprise PKS",
"product_version": "1.4.0-build.31"
}
]
},
{
"additions": [
{
"change_type": "addition",
"deployment_status": "successful",
"guid": "pivotal-container-service-5c28f63410227c2221c8",
"identifier": "pivotal-container-service",
"label": "Enterprise PKS",
"product_version": "1.4.0-build.31"
}
],
"deletions": [],
"finished_at": "2019-05-15T00:08:32.241Z",
"id": 2,
"started_at": "2019-05-14T23:33:58.105Z",
"status": "succeeded",
"unchanged": [
{
"change_type": "unchanged",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"updates": []
},
{
"additions": [
{
"change_type": "addition",
"deployment_status": "successful",
"guid": "p-bosh-c1853604618b1b3e10fd",
"identifier": "p-bosh",
"label": "BOSH Director",
"product_version": "2.5.3-build.185"
}
],
"deletions": [],
"finished_at": "2019-05-14T23:29:47.525Z",
"id": 1,
"started_at": "2019-05-14T23:13:13.244Z",
"status": "succeeded",
"unchanged": [],
"updates": []
}
]
}
Optionally you should send this TAR file output on every ticket/case your create so support has a great snapshot of what your ENV looks like to help diagnose support issues for you.
telemetry-collector send --path --api-key
For the API-KEY please contact your Pivotal AE or Platform Architect to request that as the Telemetry team issues API key to customer's
More Information
https://docs.pivotal.io/telemetry/1-1/index.html
Categories: Fusion Middleware
Basic VMware Harbor Registry usage for Pivotal Container Service (PKS)
VMware Harbor Registry is an enterprise-class registry server that stores and distributes container images. Harbor allows you to store and manage images for use with Enterprise Pivotal Container Service (Enterprise PKS).
In this simple example we show what you need at a minimum to get an image on Harbor deployed onto your PKS cluster. First we need the following to be able to run this basic demo
Required Steps
1. PKS installed with Harbor Registry tile added as shown below
2. VMware Harbor Registry integrated with Enterprise PKS as per the link below. The most important step is the one as follows "Import the CA Certificate Used to Sign the Harbor Certificate and Key to BOSH". You must complete that prior to creating a PKS cluster
https://docs.pivotal.io/partners/vmware-harbor/integrating-pks.html
3. A PKS cluster created. You must have completed step #2 before you create the cluster
https://docs.pivotal.io/pks/1-4/create-cluster.html
$ pks cluster oranges
Name: oranges
Plan Name: small
UUID: 21998d0d-b9f8-437c-850c-6ee0ed33d781
Last Action: CREATE
Last Action State: succeeded
Last Action Description: Instance provisioning completed
Kubernetes Master Host: oranges.run.yyyy.bbbb.pivotal.io
Kubernetes Master Port: 8443
Worker Nodes: 4
Kubernetes Master IP(s): 1.1.1.1
Network Profile Name:
4. Docker Desktop Installed on your local machine
Steps
1. First let's log into Harbor and create a new project. Make sure you record your username and password you have assigned for the project. In this example I make the project public.
Details
2. Next in order to be able to connect to our registry from our local laptop we will need to install
The VMware Harbor registry isn't running on a public domain, and is using a self-signed certificate. So we need to access this registry with self-signed certificates from my mac osx clients given I am using Docker for Mac. This link shows how to add the self signed certificate to Linux and Mac clients
https://blog.container-solutions.com/adding-self-signed-registry-certs-docker-mac
You can download the self signed cert from Pivotal Ops Manager as sown below
With all that in place a command as follows is all I need to run
$ sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ca.crt
3. Now lets login to the registry using a command as follows
$ docker login harbor.haas-bbb.yyyy.pivotal.io -u pas
Password:
Login Succeeded
4. Now I have an image sitting on Docker Hub itself so let's tag that and then deploy that to our VMware Harbor registry as shown below
$ docker tag pasapples/customer-api:latest harbor.haas-bbb.yyyy.io/cto_apj/customer-api:latest
$ docker push harbor.haas-bbb.yyyy.io/cto_apj/customer-api:latest
5. Now lets create a new secret for accessing the container registry
$ kubectl create secret docker-registry regcred --docker-server=harbor.haas-bbb.yyyy.io --docker-username=pas --docker-password=**** --docker-email=papicella@pivotal.io
6. Now let's deploy this image to our PKS cluster using a deployment YAML file as follows
customer-api.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: customer-api
spec:
replicas: 1
template:
metadata:
labels:
app: customer-api
spec:
containers:
- name: customer-api
image: harbor.haas-206.pez.pivotal.io/cto_apj/customer-api:latest
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: customer-api-service
labels:
name: customer-api-service
spec:
ports:
- port: 80
targetPort: 8080
protocol: TCP
selector:
app: customer-api
type: LoadBalancer
7. Deploy as follows
$ kubectl create -f customer-api.yaml
8. You should see the POD and SERVICE running as follows
$ kubectl get pods | grep customer-api
customer-api-7b8fcd5778-czh46 1/1 Running 0 58s
$ kubectl get svc | grep customer-api
customer-api-service LoadBalancer 10.100.2.2 10.195.1.1.80.5 80:31156/TCP
More Information
PKS Release Notes 1.4
https://docs.pivotal.io/pks/1-4/release-notes.html
VMware Harbor Registry
https://docs.vmware.com/en/VMware-Enterprise-PKS/1.4/vmware-harbor-registry/GUID-index.html
In this simple example we show what you need at a minimum to get an image on Harbor deployed onto your PKS cluster. First we need the following to be able to run this basic demo
Required Steps
1. PKS installed with Harbor Registry tile added as shown below
2. VMware Harbor Registry integrated with Enterprise PKS as per the link below. The most important step is the one as follows "Import the CA Certificate Used to Sign the Harbor Certificate and Key to BOSH". You must complete that prior to creating a PKS cluster
https://docs.pivotal.io/partners/vmware-harbor/integrating-pks.html
3. A PKS cluster created. You must have completed step #2 before you create the cluster
https://docs.pivotal.io/pks/1-4/create-cluster.html
$ pks cluster oranges
Name: oranges
Plan Name: small
UUID: 21998d0d-b9f8-437c-850c-6ee0ed33d781
Last Action: CREATE
Last Action State: succeeded
Last Action Description: Instance provisioning completed
Kubernetes Master Host: oranges.run.yyyy.bbbb.pivotal.io
Kubernetes Master Port: 8443
Worker Nodes: 4
Kubernetes Master IP(s): 1.1.1.1
Network Profile Name:
4. Docker Desktop Installed on your local machine
Steps
1. First let's log into Harbor and create a new project. Make sure you record your username and password you have assigned for the project. In this example I make the project public.
Details
- Project Name: cto_apj
- Username: pas
- Password: ****
2. Next in order to be able to connect to our registry from our local laptop we will need to install
The VMware Harbor registry isn't running on a public domain, and is using a self-signed certificate. So we need to access this registry with self-signed certificates from my mac osx clients given I am using Docker for Mac. This link shows how to add the self signed certificate to Linux and Mac clients
https://blog.container-solutions.com/adding-self-signed-registry-certs-docker-mac
You can download the self signed cert from Pivotal Ops Manager as sown below
With all that in place a command as follows is all I need to run
$ sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ca.crt
3. Now lets login to the registry using a command as follows
$ docker login harbor.haas-bbb.yyyy.pivotal.io -u pas
Password:
Login Succeeded
4. Now I have an image sitting on Docker Hub itself so let's tag that and then deploy that to our VMware Harbor registry as shown below
$ docker tag pasapples/customer-api:latest harbor.haas-bbb.yyyy.io/cto_apj/customer-api:latest
$ docker push harbor.haas-bbb.yyyy.io/cto_apj/customer-api:latest
5. Now lets create a new secret for accessing the container registry
$ kubectl create secret docker-registry regcred --docker-server=harbor.haas-bbb.yyyy.io --docker-username=pas --docker-password=**** --docker-email=papicella@pivotal.io
6. Now let's deploy this image to our PKS cluster using a deployment YAML file as follows
customer-api.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: customer-api
spec:
replicas: 1
template:
metadata:
labels:
app: customer-api
spec:
containers:
- name: customer-api
image: harbor.haas-206.pez.pivotal.io/cto_apj/customer-api:latest
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: customer-api-service
labels:
name: customer-api-service
spec:
ports:
- port: 80
targetPort: 8080
protocol: TCP
selector:
app: customer-api
type: LoadBalancer
7. Deploy as follows
$ kubectl create -f customer-api.yaml
8. You should see the POD and SERVICE running as follows
$ kubectl get pods | grep customer-api
customer-api-7b8fcd5778-czh46 1/1 Running 0 58s
$ kubectl get svc | grep customer-api
customer-api-service LoadBalancer 10.100.2.2 10.195.1.1.80.5 80:31156/TCP
More Information
PKS Release Notes 1.4
https://docs.pivotal.io/pks/1-4/release-notes.html
VMware Harbor Registry
https://docs.vmware.com/en/VMware-Enterprise-PKS/1.4/vmware-harbor-registry/GUID-index.html
Categories: Fusion Middleware
Taking kpack, a Kubernetes Native Container Build Service for a test drive
We wanted Build Service to combine the Cloud Native Buildpacks experience with the declarative model of Kubernetes, and extend the K8s workflow in an idiomatic fashion. With this goal in mind, we leveraged custom resource definitions to extended the K8s API. This way, we could use Kubernetes technology to create a composable, declarative architecture to power build service. The Custom Resource Definitions (CRDs) are coordinated by Custom Controllers to automate container image builds and keep them up to date based on user-provided configuration.
So with that in mind lets go and deploy kpack on GKE cluster and build our first image...
Steps
1. Install v0.0.3 of kpack into your Kube cluster
$ kubectl apply -f <(curl -L https://github.com/pivotal/kpack/releases/download/v0.0.3/release.yaml)
...
namespace/kpack created
customresourcedefinition.apiextensions.k8s.io/builds.build.pivotal.io created
customresourcedefinition.apiextensions.k8s.io/builders.build.pivotal.io created
clusterrole.rbac.authorization.k8s.io/kpack-admin created
clusterrolebinding.rbac.authorization.k8s.io/kpack-controller-admin created
deployment.apps/kpack-controller created
customresourcedefinition.apiextensions.k8s.io/images.build.pivotal.io created
serviceaccount/controller created
customresourcedefinition.apiextensions.k8s.io/sourceresolvers.build.pivotal.io created
2. Lets just verify what Custom resources definition (CRD's) have been installed
$ kubectl api-resources --api-group build.pivotal.io
NAME SHORTNAMES APIGROUP NAMESPACED KIND
builders cnbbuilder,cnbbuilders,bldr build.pivotal.io true Builder
builds cnbbuild,cnbbuilds,bld build.pivotal.io true Build
images cnbimage,cnbimages build.pivotal.io true Image
sourceresolvers build.pivotal.io true SourceResolver
3. Create a builder resource as follows
builder-resource.yaml
apiVersion: build.pivotal.io/v1alpha1
kind: Builder
metadata:
name: sample-builder
spec:
image: cloudfoundry/cnb:bionic
updatePolicy: polling
$ kubectl create -f builder-resource.yaml
builder.build.pivotal.io/sample-builder created
$ kubectl get builds,images,builders,sourceresolvers
NAME AGE
builder.build.pivotal.io/sample-builder 42s
4. Create a secret for push access to the desired docker registry
docker-secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: basic-docker-user-pass
annotations:
build.pivotal.io/docker: index.docker.io
type: kubernetes.io/basic-auth
stringData:
username: papicella
password:
$ kubectl create -f docker-secret.yaml
secret/basic-docker-user-pass created
5. Create a secret for pull access from the desired git repository. The example below is for a github repository
git-secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: basic-git-user-pass
annotations:
build.pivotal.io/git: https://github.com
type: kubernetes.io/basic-auth
stringData:
username: papicella
password:
$ kubectl create -f git-secret.yaml
secret/basic-git-user-pass created
6. Create a service account that uses the docker registry secret and the git repository secret.
service-account.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: service-account
secrets:
- name: basic-docker-user-pass
- name: basic-git-user-pass
$ kubectl create -f service-account.yaml
serviceaccount/service-account created
7. Install logs utility. In order to view the build logs for each image as it's created right now you have to use a utility that you build from the kpack github repo source fils itself. Follow the steps below to get it built
$ export GOPATH=`pwd`
$ git clone https://github.com/pivotal/kpack $GOPATH/src/github.com/pivotal/kpack
$ cd $GOPATH/src/github.com/pivotal/kpack
$ dep ensure -v
$ go build ./cmd/logs
You will have "logs" executable created in current directory which we will use it shortly
8. Create an image as follows. The GitHub repo I have here is public so will work no problem at all
pbs-demo-sample-image.yaml
apiVersion: build.pivotal.io/v1alpha1
kind: Image
metadata:
name: pbs-demo-image
spec:
tag: pasapples/pbs-demo-image
serviceAccount: service-account
builderRef: sample-builder
cacheSize: "1.5Gi" # Optional, if not set then the caching feature is disabled
failedBuildHistoryLimit: 5 # Optional, if not present defaults to 10
successBuildHistoryLimit: 5 # Optional, if not present defaults to 10
source:
git:
url: https://github.com/papicella/pbs-demo
revision: master
build: # Optional
env:
- name: BP_JAVA_VERSION
value: 11.*
resources:
limits:
cpu: 100m
memory: 1G
requests:
cpu: 50m
memory: 512M
$ kubectl create -f pbs-demo-sample-image.yaml
image.build.pivotal.io/sample-image created
9. Now at this point we can view the created image and current Cloud native Buildpack builds being run using two commands as follows.
$ kubectl get images
NAME LATESTIMAGE READY
pbs-demo-image Unknown
$ kubectl get cnbbuilds
NAME IMAGE SUCCEEDED
pbs-demo-image-build-1-pvh6k Unknown
Note: Unknown is normal as it has not yet completed
10. Now using our created "logs" utility lets view the current build logs
$ ./logs -image pbs-demo-image
{"level":"info","ts":1568175056.446671,"logger":"fallback-logger","caller":"creds-init/main.go:40","msg":"Credentials initialized.","commit":"002a41a"}
source-init:main.go:277: Successfully cloned "https://github.com/papicella/pbs-demo" @ "cee67e26d55b6d2735afd7fa3e0b81e251e0d5ce" in path "/workspace"
2019/09/11 04:11:23 Unable to read "/root/.docker/config.json": open /root/.docker/config.json: no such file or directory
======== Results ========
skip: org.cloudfoundry.archiveexpanding@1.0.0-RC03
pass: org.cloudfoundry.openjdk@1.0.0-RC03
pass: org.cloudfoundry.buildsystem@1.0.0-RC03
pass: org.cloudfoundry.jvmapplication@1.0.0-RC03
pass: org.cloudfoundry.tomcat@1.0.0-RC03
pass: org.cloudfoundry.springboot@1.0.0-RC03
pass: org.cloudfoundry.distzip@1.0.0-RC03
skip: org.cloudfoundry.procfile@1.0.0-RC03
skip: org.cloudfoundry.azureapplicationinsights@1.0.0-RC03
skip: org.cloudfoundry.debug@1.0.0-RC03
skip: org.cloudfoundry.googlestackdriver@1.0.0-RC03
skip: org.cloudfoundry.jdbc@1.0.0-RC03
skip: org.cloudfoundry.jmx@1.0.0-RC03
pass: org.cloudfoundry.springautoreconfiguration@1.0.0-RC03
Resolving plan... (try #1)
Success! (7)
Cache '/cache': metadata not found, nothing to restore
Analyzing image 'index.docker.io/pasapples/pbs-demo-image@sha256:40fe8aa932037faad697c3934667241eef620aac1d09fc7bb5ec5a75d5921e3e'
Writing metadata for uncached layer 'org.cloudfoundry.openjdk:openjdk-jre'
......
11. Now this will take some time to do our first build given it will hagve to download all the maven dependancies but you may be wondering how do we determine how many builds have been run so we can actually view the logs of any builds across our image we just created. To do that run a command as follows
$ kubectl get pods --show-labels | grep pbs-demo-image
pbs-demo-image-build-1-pvh6k-build-pod 0/1 Init:6/9 0 6m29s image.build.pivotal.io/buildNumber=1,image.build.pivotal.io/image=pbs-demo-image
12. So from the output above you can clearly see we just have the one single build so to view logs of just a particular build we use it's ID as shown above as follows
$ ./logs -image pbs-demo-image -build {ID}
...
13. Now if we wait at least 5 minutes as the first build will always take time just to the dependancies required to be downloaded it will eventually complete and show it's complete using the following commands
$ kubectl get images
NAME LATESTIMAGE READY
pbs-demo-image index.docker.io/pasapples/pbs-demo-image@sha256:a2d4082004d686bb2c76222a631b8a9b3866bef54c1fae03261986a528b556fe True
$ kubectl get cnbbuilds
NAME IMAGE SUCCEEDED
pbs-demo-image-build-1-pvh6k index.docker.io/pasapples/pbs-demo-image@sha256:a2d4082004d686bb2c76222a631b8a9b3866bef54c1fae03261986a528b556fe True
14. Now let's actually make a code change to our source code and issue a git commit. In this example below I am using IntelliJ IDEA for my code change/commit
15. Now let's see if a new build is kicked off it should be. Run the following command
$ kubectl get cnbbuilds
NAME IMAGE SUCCEEDED
pbs-demo-image-build-1-pvh6k index.docker.io/pasapples/pbs-demo-image@sha256:a2d4082004d686bb2c76222a631b8a9b3866bef54c1fae03261986a528b556fe True
pbs-demo-image-build-2-stl8w Unknown
16. Now lets see that in fact this new build is build ID 2 using a command as follows
$ kubectl get pods --show-labels | grep pbs-demo-image
pbs-demo-image-build-1-pvh6k-build-pod 0/1 Completed 0 21m image.build.pivotal.io/buildNumber=1,image.build.pivotal.io/image=pbs-demo-image
pbs-demo-image-build-2-stl8w-build-pod 0/1 Init:6/9 0 2m15s image.build.pivotal.io/buildNumber=2,image.build.pivotal.io/image=pbs-demo-image
17. Lets view the logs for BUILD 2 as follows
$ ./logs -image pbs-demo-image -build 2
{"level":"info","ts":1568176191.088838,"logger":"fallback-logger","caller":"creds-init/main.go:40","msg":"Credentials initialized.","commit":"002a41a"}
source-init:main.go:277: Successfully cloned "https://github.com/papicella/pbs-demo" @ "e2830bbcfb32bfdd72bf5d4b17428c405f46f3c1" in path "/workspace"
2019/09/11 04:29:55 Unable to read "/root/.docker/config.json": open /root/.docker/config.json: no such file or directory
======== Results ========
skip: org.cloudfoundry.archiveexpanding@1.0.0-RC03
pass: org.cloudfoundry.openjdk@1.0.0-RC03
pass: org.cloudfoundry.buildsystem@1.0.0-RC03
pass: org.cloudfoundry.jvmapplication@1.0.0-RC03
pass: org.cloudfoundry.tomcat@1.0.0-RC03
pass: org.cloudfoundry.springboot@1.0.0-RC03
pass: org.cloudfoundry.distzip@1.0.0-RC03
skip: org.cloudfoundry.procfile@1.0.0-RC03
skip: org.cloudfoundry.azureapplicationinsights@1.0.0-RC03
skip: org.cloudfoundry.debug@1.0.0-RC03
skip: org.cloudfoundry.googlestackdriver@1.0.0-RC03
skip: org.cloudfoundry.jdbc@1.0.0-RC03
skip: org.cloudfoundry.jmx@1.0.0-RC03
pass: org.cloudfoundry.springautoreconfiguration@1.0.0-RC03
Resolving plan... (try #1)
Success! (7)
Restoring cached layer 'org.cloudfoundry.openjdk:openjdk-jdk'
Restoring cached layer 'org.cloudfoundry.openjdk:90c33cf3f2ed0bd773f648815de7347e69cfbb3416ef3bf41616ab1c4aa0f5a8'
Restoring cached layer 'org.cloudfoundry.buildsystem:build-system-cache'
Restoring cached layer 'org.cloudfoundry.jvmapplication:executable-jar'
Restoring cached layer 'org.cloudfoundry.springboot:spring-boot'
Analyzing image 'index.docker.io/pasapples/pbs-demo-image@sha256:a2d4082004d686bb2c76222a631b8a9b3866bef54c1fae03261986a528b556fe'
Using cached layer 'org.cloudfoundry.openjdk:90c33cf3f2ed0bd773f648815de7347e69cfbb3416ef3bf41616ab1c4aa0f5a8'
Using cached layer 'org.cloudfoundry.openjdk:openjdk-jdk'
Writing metadata for uncached layer 'org.cloudfoundry.openjdk:openjdk-jre'
Using cached layer 'org.cloudfoundry.buildsystem:build-system-cache'
Using cached launch layer 'org.cloudfoundry.jvmapplication:executable-jar'
Rewriting metadata for layer 'org.cloudfoundry.jvmapplication:executable-jar'
Using cached launch layer 'org.cloudfoundry.springboot:spring-boot'
Rewriting metadata for layer 'org.cloudfoundry.springboot:spring-boot'
Writing metadata for uncached layer 'org.cloudfoundry.springautoreconfiguration:auto-reconfiguration'
Cloud Foundry OpenJDK Buildpack 1.0.0-RC03
OpenJDK JDK 11.0.4: Reusing cached layer
OpenJDK JRE 11.0.4: Reusing cached layer
Cloud Foundry Build System Buildpack 1.0.0-RC03
Using wrapper
Linking Cache to /home/cnb/.m2
Compiled Application: Contributing to layer
Executing /workspace/mvnw -Dmaven.test.skip=true package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< com.example:pbs-demo >------------------------
[INFO] Building pbs-demo 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ pbs-demo ---
...
18. Now this build won't take as long as the first build as this time we don't have to pull down the maven dependancies plus avoid creating layers that have not changes in the first OCI complaint image which is something cloud native buildpacks does for us nicely. Once complete you now have two builds as follows
$ kubectl get cnbbuilds
NAME IMAGE SUCCEEDED
pbs-demo-image-build-1-pvh6k index.docker.io/pasapples/pbs-demo-image@sha256:a2d4082004d686bb2c76222a631b8a9b3866bef54c1fae03261986a528b556fe True
pbs-demo-image-build-2-stl8w index.docker.io/pasapples/pbs-demo-image@sha256:a22c64754cb7addc3f7e9a9335b094adf466b5f8035227691e81403d0c9c177f True
19. Now let's run this locally as follows given I have docker desktop running. First we pull down the created image which in this case is the LATEST build build 2 here
$ docker pull pasapples/pbs-demo-image
Using default tag: latest
latest: Pulling from pasapples/pbs-demo-image
35c102085707: Already exists
251f5509d51d: Already exists
8e829fe70a46: Already exists
6001e1789921: Already exists
76a30c9e6d47: Pull complete
8538f1fe6188: Pull complete
2a899c7e684d: Pull complete
0ea0c38329cb: Pull complete
bb281735f842: Pull complete
664d87aab7ff: Pull complete
f4b03070a779: Pull complete
682af613b7ca: Pull complete
b893e5904080: Pull complete
Digest: sha256:a22c64754cb7addc3f7e9a9335b094adf466b5f8035227691e81403d0c9c177f
Status: Downloaded newer image for pasapples/pbs-demo-image:latest
20. Now let's run it
$ docker run -p 8080:8080 pasapples/pbs-demo-image
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.6.RELEASE)
2019-09-11 04:40:41.747 WARN 1 --- [ main] pertySourceApplicationContextInitializer : Skipping 'cloud' property source addition because not in a cloud
2019-09-11 04:40:41.751 WARN 1 --- [ main] nfigurationApplicationContextInitializer : Skipping reconfiguration because not in a cloud
2019-09-11 04:40:41.760 INFO 1 --- [ main] com.example.pbsdemo.PbsDemoApplication : Starting PbsDemoApplication on 5975633400c4 with PID 1 (/workspace/BOOT-INF/classes started by cnb in /workspace)
...
2019-09-11 04:40:50.255 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2019-09-11 04:40:50.259 INFO 1 --- [ main] com.example.pbsdemo.PbsDemoApplication : Started PbsDemoApplication in 8.93 seconds (JVM running for 9.509)
Hibernate: insert into customer (id, name, status) values (null, ?, ?)
2019-09-11 04:40:50.323 INFO 1 --- [ main] com.example.pbsdemo.LoadDatabase : Preloading Customer(id=1, name=pas, status=active)
Hibernate: insert into customer (id, name, status) values (null, ?, ?)
2019-09-11 04:40:50.326 INFO 1 --- [ main] com.example.pbsdemo.LoadDatabase : Preloading Customer(id=2, name=lucia, status=active)
Hibernate: insert into customer (id, name, status) values (null, ?, ?)
2019-09-11 04:40:50.329 INFO 1 --- [ main] com.example.pbsdemo.LoadDatabase : Preloading Customer(id=3, name=lucas, status=inactive)
Hibernate: insert into customer (id, name, status) values (null, ?, ?)
2019-09-11 04:40:50.331 INFO 1 --- [ main] com.example.pbsdemo.LoadDatabase : Preloading Customer(id=4, name=siena, status=inactive)
21. Invoke it through a browser as follows
http://localhost:8080/swagger-ui.html
22. Finally let's actually run this application on our k8s cluster itself. So start by creating a basic YAML file for deployment as follows
run-pbs-image-k8s-yaml.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: pbs-demo-image
spec:
replicas: 2
template:
metadata:
labels:
app: pbs-demo-image
spec:
containers:
- name: pbs-demo-image
image: pasapples/pbs-demo-image
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: pbs-demo-image-service
labels:
name: pbs-demo-image-service
spec:
ports:
- port: 80
targetPort: 8080
protocol: TCP
selector:
app: pbs-demo-image
type: LoadBalancer
23. Apply your config
$ kubectl create -f run-pbs-image-k8s-yaml.yaml
deployment.extensions/pbs-demo-image created
service/pbs-demo-image-service created
24. Check we have running pods and LB service created
$ kubectl get all
NAME READY STATUS RESTARTS AGE
pod/pbs-demo-image-build-1-pvh6k-build-pod 0/1 Completed 0 39m
pod/pbs-demo-image-build-2-stl8w-build-pod 0/1 Completed 0 19m
pod/pbs-demo-image-f5c9d989-l2hg5 1/1 Running 0 48s
pod/pbs-demo-image-f5c9d989-pfxzs 1/1 Running 0 48s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.101.0.1 443/TCP 86m
service/pbs-demo-image-service LoadBalancer 10.101.15.197 80:30769/TCP 49s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/pbs-demo-image 2/2 2 2 49s
NAME DESIRED CURRENT READY AGE
replicaset.apps/pbs-demo-image-f5c9d989 2 2 2 50s
More Information
Introducing kpack, a Kubernetes Native Container Build Service
https://content.pivotal.io/blog/introducing-kpack-a-kubernetes-native-container-build-service
Cloud Native Buildpacks
https://buildpacks.io/
So with that in mind lets go and deploy kpack on GKE cluster and build our first image...
Steps
1. Install v0.0.3 of kpack into your Kube cluster
$ kubectl apply -f <(curl -L https://github.com/pivotal/kpack/releases/download/v0.0.3/release.yaml)
...
namespace/kpack created
customresourcedefinition.apiextensions.k8s.io/builds.build.pivotal.io created
customresourcedefinition.apiextensions.k8s.io/builders.build.pivotal.io created
clusterrole.rbac.authorization.k8s.io/kpack-admin created
clusterrolebinding.rbac.authorization.k8s.io/kpack-controller-admin created
deployment.apps/kpack-controller created
customresourcedefinition.apiextensions.k8s.io/images.build.pivotal.io created
serviceaccount/controller created
customresourcedefinition.apiextensions.k8s.io/sourceresolvers.build.pivotal.io created
2. Lets just verify what Custom resources definition (CRD's) have been installed
$ kubectl api-resources --api-group build.pivotal.io
NAME SHORTNAMES APIGROUP NAMESPACED KIND
builders cnbbuilder,cnbbuilders,bldr build.pivotal.io true Builder
builds cnbbuild,cnbbuilds,bld build.pivotal.io true Build
images cnbimage,cnbimages build.pivotal.io true Image
sourceresolvers build.pivotal.io true SourceResolver
3. Create a builder resource as follows
builder-resource.yaml
apiVersion: build.pivotal.io/v1alpha1
kind: Builder
metadata:
name: sample-builder
spec:
image: cloudfoundry/cnb:bionic
updatePolicy: polling
$ kubectl create -f builder-resource.yaml
builder.build.pivotal.io/sample-builder created
$ kubectl get builds,images,builders,sourceresolvers
NAME AGE
builder.build.pivotal.io/sample-builder 42s
4. Create a secret for push access to the desired docker registry
docker-secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: basic-docker-user-pass
annotations:
build.pivotal.io/docker: index.docker.io
type: kubernetes.io/basic-auth
stringData:
username: papicella
password:
$ kubectl create -f docker-secret.yaml
secret/basic-docker-user-pass created
5. Create a secret for pull access from the desired git repository. The example below is for a github repository
git-secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: basic-git-user-pass
annotations:
build.pivotal.io/git: https://github.com
type: kubernetes.io/basic-auth
stringData:
username: papicella
password:
$ kubectl create -f git-secret.yaml
secret/basic-git-user-pass created
6. Create a service account that uses the docker registry secret and the git repository secret.
service-account.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: service-account
secrets:
- name: basic-docker-user-pass
- name: basic-git-user-pass
$ kubectl create -f service-account.yaml
serviceaccount/service-account created
7. Install logs utility. In order to view the build logs for each image as it's created right now you have to use a utility that you build from the kpack github repo source fils itself. Follow the steps below to get it built
$ export GOPATH=`pwd`
$ git clone https://github.com/pivotal/kpack $GOPATH/src/github.com/pivotal/kpack
$ cd $GOPATH/src/github.com/pivotal/kpack
$ dep ensure -v
$ go build ./cmd/logs
You will have "logs" executable created in current directory which we will use it shortly
8. Create an image as follows. The GitHub repo I have here is public so will work no problem at all
pbs-demo-sample-image.yaml
apiVersion: build.pivotal.io/v1alpha1
kind: Image
metadata:
name: pbs-demo-image
spec:
tag: pasapples/pbs-demo-image
serviceAccount: service-account
builderRef: sample-builder
cacheSize: "1.5Gi" # Optional, if not set then the caching feature is disabled
failedBuildHistoryLimit: 5 # Optional, if not present defaults to 10
successBuildHistoryLimit: 5 # Optional, if not present defaults to 10
source:
git:
url: https://github.com/papicella/pbs-demo
revision: master
build: # Optional
env:
- name: BP_JAVA_VERSION
value: 11.*
resources:
limits:
cpu: 100m
memory: 1G
requests:
cpu: 50m
memory: 512M
$ kubectl create -f pbs-demo-sample-image.yaml
image.build.pivotal.io/sample-image created
9. Now at this point we can view the created image and current Cloud native Buildpack builds being run using two commands as follows.
$ kubectl get images
NAME LATESTIMAGE READY
pbs-demo-image Unknown
$ kubectl get cnbbuilds
NAME IMAGE SUCCEEDED
pbs-demo-image-build-1-pvh6k Unknown
Note: Unknown is normal as it has not yet completed
10. Now using our created "logs" utility lets view the current build logs
$ ./logs -image pbs-demo-image
{"level":"info","ts":1568175056.446671,"logger":"fallback-logger","caller":"creds-init/main.go:40","msg":"Credentials initialized.","commit":"002a41a"}
source-init:main.go:277: Successfully cloned "https://github.com/papicella/pbs-demo" @ "cee67e26d55b6d2735afd7fa3e0b81e251e0d5ce" in path "/workspace"
2019/09/11 04:11:23 Unable to read "/root/.docker/config.json": open /root/.docker/config.json: no such file or directory
======== Results ========
skip: org.cloudfoundry.archiveexpanding@1.0.0-RC03
pass: org.cloudfoundry.openjdk@1.0.0-RC03
pass: org.cloudfoundry.buildsystem@1.0.0-RC03
pass: org.cloudfoundry.jvmapplication@1.0.0-RC03
pass: org.cloudfoundry.tomcat@1.0.0-RC03
pass: org.cloudfoundry.springboot@1.0.0-RC03
pass: org.cloudfoundry.distzip@1.0.0-RC03
skip: org.cloudfoundry.procfile@1.0.0-RC03
skip: org.cloudfoundry.azureapplicationinsights@1.0.0-RC03
skip: org.cloudfoundry.debug@1.0.0-RC03
skip: org.cloudfoundry.googlestackdriver@1.0.0-RC03
skip: org.cloudfoundry.jdbc@1.0.0-RC03
skip: org.cloudfoundry.jmx@1.0.0-RC03
pass: org.cloudfoundry.springautoreconfiguration@1.0.0-RC03
Resolving plan... (try #1)
Success! (7)
Cache '/cache': metadata not found, nothing to restore
Analyzing image 'index.docker.io/pasapples/pbs-demo-image@sha256:40fe8aa932037faad697c3934667241eef620aac1d09fc7bb5ec5a75d5921e3e'
Writing metadata for uncached layer 'org.cloudfoundry.openjdk:openjdk-jre'
......
11. Now this will take some time to do our first build given it will hagve to download all the maven dependancies but you may be wondering how do we determine how many builds have been run so we can actually view the logs of any builds across our image we just created. To do that run a command as follows
$ kubectl get pods --show-labels | grep pbs-demo-image
pbs-demo-image-build-1-pvh6k-build-pod 0/1 Init:6/9 0 6m29s image.build.pivotal.io/buildNumber=1,image.build.pivotal.io/image=pbs-demo-image
12. So from the output above you can clearly see we just have the one single build so to view logs of just a particular build we use it's ID as shown above as follows
$ ./logs -image pbs-demo-image -build {ID}
...
13. Now if we wait at least 5 minutes as the first build will always take time just to the dependancies required to be downloaded it will eventually complete and show it's complete using the following commands
$ kubectl get images
NAME LATESTIMAGE READY
pbs-demo-image index.docker.io/pasapples/pbs-demo-image@sha256:a2d4082004d686bb2c76222a631b8a9b3866bef54c1fae03261986a528b556fe True
$ kubectl get cnbbuilds
NAME IMAGE SUCCEEDED
pbs-demo-image-build-1-pvh6k index.docker.io/pasapples/pbs-demo-image@sha256:a2d4082004d686bb2c76222a631b8a9b3866bef54c1fae03261986a528b556fe True
14. Now let's actually make a code change to our source code and issue a git commit. In this example below I am using IntelliJ IDEA for my code change/commit
15. Now let's see if a new build is kicked off it should be. Run the following command
$ kubectl get cnbbuilds
NAME IMAGE SUCCEEDED
pbs-demo-image-build-1-pvh6k index.docker.io/pasapples/pbs-demo-image@sha256:a2d4082004d686bb2c76222a631b8a9b3866bef54c1fae03261986a528b556fe True
pbs-demo-image-build-2-stl8w Unknown
16. Now lets see that in fact this new build is build ID 2 using a command as follows
$ kubectl get pods --show-labels | grep pbs-demo-image
pbs-demo-image-build-1-pvh6k-build-pod 0/1 Completed 0 21m image.build.pivotal.io/buildNumber=1,image.build.pivotal.io/image=pbs-demo-image
pbs-demo-image-build-2-stl8w-build-pod 0/1 Init:6/9 0 2m15s image.build.pivotal.io/buildNumber=2,image.build.pivotal.io/image=pbs-demo-image
17. Lets view the logs for BUILD 2 as follows
$ ./logs -image pbs-demo-image -build 2
{"level":"info","ts":1568176191.088838,"logger":"fallback-logger","caller":"creds-init/main.go:40","msg":"Credentials initialized.","commit":"002a41a"}
source-init:main.go:277: Successfully cloned "https://github.com/papicella/pbs-demo" @ "e2830bbcfb32bfdd72bf5d4b17428c405f46f3c1" in path "/workspace"
2019/09/11 04:29:55 Unable to read "/root/.docker/config.json": open /root/.docker/config.json: no such file or directory
======== Results ========
skip: org.cloudfoundry.archiveexpanding@1.0.0-RC03
pass: org.cloudfoundry.openjdk@1.0.0-RC03
pass: org.cloudfoundry.buildsystem@1.0.0-RC03
pass: org.cloudfoundry.jvmapplication@1.0.0-RC03
pass: org.cloudfoundry.tomcat@1.0.0-RC03
pass: org.cloudfoundry.springboot@1.0.0-RC03
pass: org.cloudfoundry.distzip@1.0.0-RC03
skip: org.cloudfoundry.procfile@1.0.0-RC03
skip: org.cloudfoundry.azureapplicationinsights@1.0.0-RC03
skip: org.cloudfoundry.debug@1.0.0-RC03
skip: org.cloudfoundry.googlestackdriver@1.0.0-RC03
skip: org.cloudfoundry.jdbc@1.0.0-RC03
skip: org.cloudfoundry.jmx@1.0.0-RC03
pass: org.cloudfoundry.springautoreconfiguration@1.0.0-RC03
Resolving plan... (try #1)
Success! (7)
Restoring cached layer 'org.cloudfoundry.openjdk:openjdk-jdk'
Restoring cached layer 'org.cloudfoundry.openjdk:90c33cf3f2ed0bd773f648815de7347e69cfbb3416ef3bf41616ab1c4aa0f5a8'
Restoring cached layer 'org.cloudfoundry.buildsystem:build-system-cache'
Restoring cached layer 'org.cloudfoundry.jvmapplication:executable-jar'
Restoring cached layer 'org.cloudfoundry.springboot:spring-boot'
Analyzing image 'index.docker.io/pasapples/pbs-demo-image@sha256:a2d4082004d686bb2c76222a631b8a9b3866bef54c1fae03261986a528b556fe'
Using cached layer 'org.cloudfoundry.openjdk:90c33cf3f2ed0bd773f648815de7347e69cfbb3416ef3bf41616ab1c4aa0f5a8'
Using cached layer 'org.cloudfoundry.openjdk:openjdk-jdk'
Writing metadata for uncached layer 'org.cloudfoundry.openjdk:openjdk-jre'
Using cached layer 'org.cloudfoundry.buildsystem:build-system-cache'
Using cached launch layer 'org.cloudfoundry.jvmapplication:executable-jar'
Rewriting metadata for layer 'org.cloudfoundry.jvmapplication:executable-jar'
Using cached launch layer 'org.cloudfoundry.springboot:spring-boot'
Rewriting metadata for layer 'org.cloudfoundry.springboot:spring-boot'
Writing metadata for uncached layer 'org.cloudfoundry.springautoreconfiguration:auto-reconfiguration'
Cloud Foundry OpenJDK Buildpack 1.0.0-RC03
OpenJDK JDK 11.0.4: Reusing cached layer
OpenJDK JRE 11.0.4: Reusing cached layer
Cloud Foundry Build System Buildpack 1.0.0-RC03
Using wrapper
Linking Cache to /home/cnb/.m2
Compiled Application: Contributing to layer
Executing /workspace/mvnw -Dmaven.test.skip=true package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< com.example:pbs-demo >------------------------
[INFO] Building pbs-demo 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ pbs-demo ---
...
18. Now this build won't take as long as the first build as this time we don't have to pull down the maven dependancies plus avoid creating layers that have not changes in the first OCI complaint image which is something cloud native buildpacks does for us nicely. Once complete you now have two builds as follows
$ kubectl get cnbbuilds
NAME IMAGE SUCCEEDED
pbs-demo-image-build-1-pvh6k index.docker.io/pasapples/pbs-demo-image@sha256:a2d4082004d686bb2c76222a631b8a9b3866bef54c1fae03261986a528b556fe True
pbs-demo-image-build-2-stl8w index.docker.io/pasapples/pbs-demo-image@sha256:a22c64754cb7addc3f7e9a9335b094adf466b5f8035227691e81403d0c9c177f True
19. Now let's run this locally as follows given I have docker desktop running. First we pull down the created image which in this case is the LATEST build build 2 here
$ docker pull pasapples/pbs-demo-image
Using default tag: latest
latest: Pulling from pasapples/pbs-demo-image
35c102085707: Already exists
251f5509d51d: Already exists
8e829fe70a46: Already exists
6001e1789921: Already exists
76a30c9e6d47: Pull complete
8538f1fe6188: Pull complete
2a899c7e684d: Pull complete
0ea0c38329cb: Pull complete
bb281735f842: Pull complete
664d87aab7ff: Pull complete
f4b03070a779: Pull complete
682af613b7ca: Pull complete
b893e5904080: Pull complete
Digest: sha256:a22c64754cb7addc3f7e9a9335b094adf466b5f8035227691e81403d0c9c177f
Status: Downloaded newer image for pasapples/pbs-demo-image:latest
20. Now let's run it
$ docker run -p 8080:8080 pasapples/pbs-demo-image
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.6.RELEASE)
2019-09-11 04:40:41.747 WARN 1 --- [ main] pertySourceApplicationContextInitializer : Skipping 'cloud' property source addition because not in a cloud
2019-09-11 04:40:41.751 WARN 1 --- [ main] nfigurationApplicationContextInitializer : Skipping reconfiguration because not in a cloud
2019-09-11 04:40:41.760 INFO 1 --- [ main] com.example.pbsdemo.PbsDemoApplication : Starting PbsDemoApplication on 5975633400c4 with PID 1 (/workspace/BOOT-INF/classes started by cnb in /workspace)
...
2019-09-11 04:40:50.255 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2019-09-11 04:40:50.259 INFO 1 --- [ main] com.example.pbsdemo.PbsDemoApplication : Started PbsDemoApplication in 8.93 seconds (JVM running for 9.509)
Hibernate: insert into customer (id, name, status) values (null, ?, ?)
2019-09-11 04:40:50.323 INFO 1 --- [ main] com.example.pbsdemo.LoadDatabase : Preloading Customer(id=1, name=pas, status=active)
Hibernate: insert into customer (id, name, status) values (null, ?, ?)
2019-09-11 04:40:50.326 INFO 1 --- [ main] com.example.pbsdemo.LoadDatabase : Preloading Customer(id=2, name=lucia, status=active)
Hibernate: insert into customer (id, name, status) values (null, ?, ?)
2019-09-11 04:40:50.329 INFO 1 --- [ main] com.example.pbsdemo.LoadDatabase : Preloading Customer(id=3, name=lucas, status=inactive)
Hibernate: insert into customer (id, name, status) values (null, ?, ?)
2019-09-11 04:40:50.331 INFO 1 --- [ main] com.example.pbsdemo.LoadDatabase : Preloading Customer(id=4, name=siena, status=inactive)
21. Invoke it through a browser as follows
http://localhost:8080/swagger-ui.html
22. Finally let's actually run this application on our k8s cluster itself. So start by creating a basic YAML file for deployment as follows
run-pbs-image-k8s-yaml.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: pbs-demo-image
spec:
replicas: 2
template:
metadata:
labels:
app: pbs-demo-image
spec:
containers:
- name: pbs-demo-image
image: pasapples/pbs-demo-image
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: pbs-demo-image-service
labels:
name: pbs-demo-image-service
spec:
ports:
- port: 80
targetPort: 8080
protocol: TCP
selector:
app: pbs-demo-image
type: LoadBalancer
23. Apply your config
$ kubectl create -f run-pbs-image-k8s-yaml.yaml
deployment.extensions/pbs-demo-image created
service/pbs-demo-image-service created
24. Check we have running pods and LB service created
$ kubectl get all
NAME READY STATUS RESTARTS AGE
pod/pbs-demo-image-build-1-pvh6k-build-pod 0/1 Completed 0 39m
pod/pbs-demo-image-build-2-stl8w-build-pod 0/1 Completed 0 19m
pod/pbs-demo-image-f5c9d989-l2hg5 1/1 Running 0 48s
pod/pbs-demo-image-f5c9d989-pfxzs 1/1 Running 0 48s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.101.0.1 443/TCP 86m
service/pbs-demo-image-service LoadBalancer 10.101.15.197 80:30769/TCP 49s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/pbs-demo-image 2/2 2 2 49s
NAME DESIRED CURRENT READY AGE
replicaset.apps/pbs-demo-image-f5c9d989 2 2 2 50s
More Information
Introducing kpack, a Kubernetes Native Container Build Service
https://content.pivotal.io/blog/introducing-kpack-a-kubernetes-native-container-build-service
Cloud Native Buildpacks
https://buildpacks.io/
Categories: Fusion Middleware
Taking Pivotal Build Service (PBS) for a test drive
Pivotal Build Service ALPHA was just released and in this blog post let's take it for a test drive to work out how it works. The Pivotal blog post about this release is below. In short it Assembles and Updates Containers in Kubernetes
https://content.pivotal.io/blog/pivotal-build-service-now-alpha-assembles-and-updates-containers-in-kubernetes
Steps:
1. Once you have deployed Pivotal Build Service, the
Note: Use the --skip-ssl-validation flag if the Pivotal Build Service targets a UAA that has a self-signed CA cert
$ pb api set https://pbs.picorivera.cf-app.com --skip-ssl-validation
Successfully set 'https://pbs.picorivera.cf-app.com' as the Build Service
2. Login using "pb login" as shown below
$ pb login
Target Build Server at: https://pbs.picorivera.cf-app.com
Username: papicella@gmail.com
Password: ******
Login successful
Using the Pivotal Build Service (PBS) requires us to create a TEAM and IMAGE. Both are explained below.
TEAM: A team is an entity on Pivotal Build Service that is used to manage authentication for the images built by Pivotal Build Service and to manage registry and git credentials for the images managed by the team
3. Create a TEAM yaml as per below and then apply that config using the pb cli
example-team.yaml
name: example-team-name
registries:
- registry: index.docker.io
username: pasapples
password: *****
repositories:
- domain: github.com
username: papicella
password: *****
$ pb team apply -f example-team.yaml
Successfully applied team 'example-team-name'
IMAGE: An image defines the specification that Pivotal Build Service uses to create images for a user.
4. Create a IMAGE yaml as per below and then apply that config using the pb cli. The PBS will automatically kick off a build.
example-image.yaml
team: example-team-name
source:
git:
url: https://github.com/papicella/pbs-demo
revision: master
image:
tag: pasapples/pbs-demo-image
$ pb image apply -f example-image.yaml
Successfully applied image configuration 'pasapples/pbs-demo-image'
$ pb image builds pasapples/pbs-demo-image
Build Status Image Started Time Finished Time Reason
----- ------ ----- ------------ ------------- ------
1 BUILDING -- 2019-08-02 09:43:06 -- CONFIG
5. You can view the logs of the build using it's ID as shown below driving off the Build ID
$ pb image logs pasapples/pbs-demo-image -b 1
papicella@papicella:~$ pb image logs pasapples/pbs-demo-image -b 1
[build-step-credential-initializer] {"level":"info","ts":1564739008.561973,"logger":"fallback-logger","caller":"creds-init/main.go:40","msg":"Credentials initialized.","commit":"002a41a"}
[build-step-credential-initializer]
[build-step-git-source-0] git-init:main.go:81: Successfully cloned "https://github.com/papicella/pbs-demo" @ "c1aae50feaffcd61c521796cd675e6576e58bc64" in path "/workspace"
[build-step-git-source-0]
[build-step-prepare]
[build-step-detect] Trying group 1 out of 3 with 27 buildpacks...
[build-step-detect] ======== Results ========
[build-step-detect] skip: Cloud Foundry Archive Expanding Buildpack
[build-step-detect] pass: Pivotal OpenJDK Buildpack
[build-step-detect] pass: Pivotal Build System Buildpack
[build-step-detect] pass: Cloud Foundry JVM Application Buildpack
[build-step-detect] pass: Cloud Foundry Spring Boot Buildpack
[build-step-detect] pass: Cloud Foundry Apache Tomcat Buildpack
[build-step-detect] pass: Cloud Foundry DistZip Buildpack
[build-step-detect] skip: Cloud Foundry Procfile Buildpack
[build-step-detect] skip: Pivotal AppDynamics Buildpack
[build-step-detect] skip: Pivotal AspectJ Buildpack
[build-step-detect] skip: Pivotal CA Introscope Buildpack
[build-step-detect] pass: Pivotal Client Certificate Mapper Buildpack
....
6. So after a few minutes or so we will see we have built our initial image from the GitHub repo and that OCI compliant image built using Cloud Native Buildpacks is created on our DockerHub account
$ pb image builds pasapples/pbs-demo-image
Build Status Image Started Time Finished Time Reason
----- ------ ----- ------------ ------------- ------
1 SUCCESS 98239112 2019-08-02 09:43:06 2019-08-02 09:44:34 CONFIG
One of the PBS job is to keep this image updated as new successful commits occur off the matser branch. Lets show how this works as per below
7. Let's make a change to the code for or GitHub repo here I do this in IntelliJ IDEA
8. Commit the changes as shown below
9. Let's see if indeed the PBS actually started a new build for us and we should see it is doing that.
$ pb image builds pasapples/pbs-demo-image
Build Status Image Started Time Finished Time Reason
----- ------ ----- ------------ ------------- ------
1 SUCCESS 98239112 2019-08-02 09:43:06 2019-08-02 09:44:34 CONFIG
2 BUILDING -- 2019-08-02 09:57:11 -- COMMIT
10. We can tail the logs as shown below and actually tail the build logs live using "-f"
papicella@papicella:~$ pb image logs pasapples/pbs-demo-image -b 2 -f
[build-step-credential-initializer] {"level":"info","ts":1564739850.5331886,"logger":"fallback-logger","caller":"creds-init/main.go:40","msg":"Credentials initialized.","commit":"002a41a"}
[build-step-credential-initializer]
[build-step-git-source-0] git-init:main.go:81: Successfully cloned "https://github.com/papicella/pbs-demo" @ "0bb81c7523be7ada3ed956569d0241cda6b410d2" in path "/workspace"
[build-step-git-source-0]
[build-step-prepare]
[build-step-detect] Trying group 1 out of 3 with 27 buildpacks...
[build-step-detect] ======== Results ========
[build-step-detect] skip: Cloud Foundry Archive Expanding Buildpack
[build-step-detect] pass: Pivotal OpenJDK Buildpack
[build-step-detect] pass: Pivotal Build System Buildpack
[build-step-detect] pass: Cloud Foundry JVM Application Buildpack
[build-step-detect] pass: Cloud Foundry Spring Boot Buildpack
[build-step-detect] pass: Cloud Foundry Apache Tomcat Buildpack
[build-step-detect] pass: Cloud Foundry DistZip Buildpack
[build-step-detect] skip: Cloud Foundry Procfile Buildpack
[build-step-detect] skip: Pivotal AppDynamics Buildpack
[build-step-detect] skip: Pivotal AspectJ Buildpack
[build-step-detect] skip: Pivotal CA Introscope Buildpack
[build-step-detect] pass: Pivotal Client Certificate Mapper Buildpack
[build-step-detect] skip: Pivotal Elastic APM Buildpack
[build-step-detect] skip: Pivotal JaCoCo Buildpack
[build-step-detect] skip: Pivotal JProfiler Buildpack
[build-step-detect] skip: Pivotal JRebel Buildpack
[build-step-detect] skip: Pivotal New Relic Buildpack
[build-step-detect] skip: Pivotal OverOps Buildpack
[build-step-detect] skip: Pivotal Riverbed AppInternals Buildpack
[build-step-detect] skip: Pivotal SkyWalking Buildpack
[build-step-detect] skip: Pivotal YourKit Buildpack
[build-step-detect] skip: Cloud Foundry Azure Application Insights Buildpack
[build-step-detect] skip: Cloud Foundry Debug Buildpack
[build-step-detect] skip: Cloud Foundry Google Stackdriver Buildpack
[build-step-detect] skip: Cloud Foundry JDBC Buildpack
[build-step-detect] skip: Cloud Foundry JMX Buildpack
[build-step-detect] pass: Cloud Foundry Spring Auto-reconfiguration Buildpack
[build-step-detect]
[build-step-restore] Restoring cached layer 'io.pivotal.openjdk:openjdk-jdk'
[build-step-restore] Restoring cached layer 'io.pivotal.buildsystem:build-system-application'
[build-step-restore] Restoring cached layer 'io.pivotal.buildsystem:build-system-cache'
[build-step-restore] Restoring cached layer 'org.cloudfoundry.jvmapplication:executable-jar'
[build-step-restore] Restoring cached layer 'org.cloudfoundry.springboot:spring-boot'
[build-step-restore]
[build-step-analyze] Analyzing image 'index.docker.io/pasapples/pbs-demo-image@sha256:982391123b47cdbac534aaeed78c5e121d89d2064b53897c23f2248a7658fa50'
[build-step-analyze] Using cached layer 'io.pivotal.openjdk:openjdk-jdk'
[build-step-analyze] Writing metadata for uncached layer 'io.pivotal.openjdk:java-security-properties'
[build-step-analyze] Writing metadata for uncached layer 'io.pivotal.openjdk:jvmkill'
[build-step-analyze] Writing metadata for uncached layer 'io.pivotal.openjdk:link-local-dns'
[build-step-analyze] Writing metadata for uncached layer 'io.pivotal.openjdk:memory-calculator'
[build-step-analyze] Writing metadata for uncached layer 'io.pivotal.openjdk:openjdk-jre'
[build-step-analyze] Writing metadata for uncached layer 'io.pivotal.openjdk:security-provider-configurer'
[build-step-analyze] Writing metadata for uncached layer 'io.pivotal.openjdk:class-counter'
[build-step-analyze] Using cached layer 'io.pivotal.buildsystem:build-system-application'
[build-step-analyze] Using cached layer 'io.pivotal.buildsystem:build-system-cache'
[build-step-analyze] Using cached launch layer 'org.cloudfoundry.jvmapplication:executable-jar'
[build-step-analyze] Rewriting metadata for layer 'org.cloudfoundry.jvmapplication:executable-jar'
[build-step-analyze] Using cached launch layer 'org.cloudfoundry.springboot:spring-boot'
[build-step-analyze] Rewriting metadata for layer 'org.cloudfoundry.springboot:spring-boot'
[build-step-analyze] Writing metadata for uncached layer 'io.pivotal.clientcertificatemapper:client-certificate-mapper'
[build-step-analyze] Writing metadata for uncached layer 'org.cloudfoundry.springautoreconfiguration:auto-reconfiguration'
[build-step-analyze]
[build-step-build]
[build-step-build] Pivotal OpenJDK Buildpack 1.0.0-M9
[build-step-build] OpenJDK JDK 11.0.3: Reusing cached layer
[build-step-build] OpenJDK JRE 11.0.3: Reusing cached layer
[build-step-build] Java Security Properties 1.0.0-M9: Reusing cached layer
[build-step-build] Security Provider Configurer 1.0.0-M9: Reusing cached layer
[build-step-build] Link-Local DNS 1.0.0-M9: Reusing cached layer
[build-step-build] JVMKill Agent 1.16.0: Reusing cached layer
[build-step-build] Class Counter 1.0.0-M9: Reusing cached layer
[build-step-build] Memory Calculator 4.0.0: Reusing cached layer
[build-step-build]
[build-step-build] Pivotal Build System Buildpack 1.0.0-M9
[build-step-build] Using wrapper
[build-step-build] Linking Cache to /home/vcap/.m2
[build-step-build] Compiled Application (141 files): Contributing to layer
[build-step-build] [INFO] Scanning for projects...
[build-step-build] [INFO]
[build-step-build] [INFO] ------------------------< com.example:pbs-demo >------------------------
[build-step-build] [INFO] Building pbs-demo 0.0.1-SNAPSHOT
[build-step-build] [INFO] --------------------------------[ jar ]---------------------------------
[build-step-build] [INFO]
[build-step-build] [INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ pbs-demo ---
[build-step-build] [INFO] Using 'UTF-8' encoding to copy filtered resources.
[build-step-build] [INFO] Copying 1 resource
[build-step-build] [INFO] Copying 0 resource
[build-step-build] [INFO]
[build-step-build] [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ pbs-demo ---
[build-step-build] [INFO] Changes detected - recompiling the module!
[build-step-build] [INFO] Compiling 9 source files to /workspace/target/classes
[build-step-build] [INFO]
[build-step-build] [INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ pbs-demo ---
[build-step-build] [INFO] Not copying test resources
[build-step-build] [INFO]
[build-step-build] [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ pbs-demo ---
[build-step-build] [INFO] Not compiling test sources
[build-step-build] [INFO]
[build-step-build] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ pbs-demo ---
[build-step-build] [INFO] Tests are skipped.
[build-step-build] [INFO]
[build-step-build] [INFO] --- maven-jar-plugin:3.1.2:jar (default-jar) @ pbs-demo ---
[build-step-build] [INFO] Building jar: /workspace/target/pbs-demo-0.0.1-SNAPSHOT.jar
[build-step-build] [INFO]
[build-step-build] [INFO] --- spring-boot-maven-plugin:2.1.6.RELEASE:repackage (repackage) @ pbs-demo ---
[build-step-build] [INFO] Replacing main artifact with repackaged archive
[build-step-build] [INFO] ------------------------------------------------------------------------
[build-step-build] [INFO] BUILD SUCCESS
[build-step-build] [INFO] ------------------------------------------------------------------------
[build-step-build] [INFO] Total time: 7.214 s
[build-step-build] [INFO] Finished at: 2019-08-02T09:57:52Z
[build-step-build] [INFO] ------------------------------------------------------------------------
[build-step-build] Removing source code
[build-step-build]
[build-step-build] Cloud Foundry JVM Application Buildpack 1.0.0-M9
[build-step-build] Executable JAR: Reusing cached layer
[build-step-build] Process types:
[build-step-build] executable-jar: java -cp $CLASSPATH $JAVA_OPTS org.springframework.boot.loader.JarLauncher
[build-step-build] task: java -cp $CLASSPATH $JAVA_OPTS org.springframework.boot.loader.JarLauncher
[build-step-build] web: java -cp $CLASSPATH $JAVA_OPTS org.springframework.boot.loader.JarLauncher
[build-step-build]
[build-step-build] Cloud Foundry Spring Boot Buildpack 1.0.0-M9
[build-step-build] Spring Boot 2.1.6.RELEASE: Reusing cached layer
[build-step-build] Process types:
[build-step-build] spring-boot: java -cp $CLASSPATH $JAVA_OPTS com.example.pbsdemo.PbsDemoApplication
[build-step-build] task: java -cp $CLASSPATH $JAVA_OPTS com.example.pbsdemo.PbsDemoApplication
[build-step-build] web: java -cp $CLASSPATH $JAVA_OPTS com.example.pbsdemo.PbsDemoApplication
[build-step-build]
[build-step-build] Pivotal Client Certificate Mapper Buildpack 1.0.0-M9
[build-step-build] Cloud Foundry Client Certificate Mapper 1.8.0: Reusing cached layer
[build-step-build]
[build-step-build] Cloud Foundry Spring Auto-reconfiguration Buildpack 1.0.0-M9
[build-step-build] Spring Auto-reconfiguration 2.7.0: Reusing cached layer
[build-step-build]
...
11. This time the build will be faster given we are using Cloud Native Buildpacks a CNCF project and it will only rebuild the layers required versus the whole image itself. You can see from the time taken of build "2"
$ pb image builds pasapples/pbs-demo-image
Build Status Image Started Time Finished Time Reason
----- ------ ----- ------------ ------------- ------
1 SUCCESS 98239112 2019-08-02 09:43:06 2019-08-02 09:44:34 CONFIG
2 SUCCESS 1e4b63b1 2019-08-02 09:57:11 2019-08-02 09:58:15 COMMIT
Hopefully this demo shows what the PBS is all about and how it will simplify how you create and keep updated your OCI compliant images.
More Information:
1. Get started with Pivotal Build Service.
https://github.com/pivotal-cf/docs-build-service/blob/master/using.md
2. Request alpha access to Build Service via this form, or by reaching out to your account team. Once you’ve gained access, you’ll see the bits on up PivNet
3. Cloud Native buildpacks
https://buildpacks.io/
https://content.pivotal.io/blog/pivotal-build-service-now-alpha-assembles-and-updates-containers-in-kubernetes
Steps:
1. Once you have deployed Pivotal Build Service, the
pb
CLI can be used to target it with the following command.Note: Use the --skip-ssl-validation flag if the Pivotal Build Service targets a UAA that has a self-signed CA cert
$ pb api set https://pbs.picorivera.cf-app.com --skip-ssl-validation
Successfully set 'https://pbs.picorivera.cf-app.com' as the Build Service
2. Login using "pb login" as shown below
$ pb login
Target Build Server at: https://pbs.picorivera.cf-app.com
Username: papicella@gmail.com
Password: ******
Login successful
Using the Pivotal Build Service (PBS) requires us to create a TEAM and IMAGE. Both are explained below.
TEAM: A team is an entity on Pivotal Build Service that is used to manage authentication for the images built by Pivotal Build Service and to manage registry and git credentials for the images managed by the team
3. Create a TEAM yaml as per below and then apply that config using the pb cli
example-team.yaml
name: example-team-name
registries:
- registry: index.docker.io
username: pasapples
password: *****
repositories:
- domain: github.com
username: papicella
password: *****
$ pb team apply -f example-team.yaml
Successfully applied team 'example-team-name'
IMAGE: An image defines the specification that Pivotal Build Service uses to create images for a user.
4. Create a IMAGE yaml as per below and then apply that config using the pb cli. The PBS will automatically kick off a build.
example-image.yaml
team: example-team-name
source:
git:
url: https://github.com/papicella/pbs-demo
revision: master
image:
tag: pasapples/pbs-demo-image
$ pb image apply -f example-image.yaml
Successfully applied image configuration 'pasapples/pbs-demo-image'
$ pb image builds pasapples/pbs-demo-image
Build Status Image Started Time Finished Time Reason
----- ------ ----- ------------ ------------- ------
1 BUILDING -- 2019-08-02 09:43:06 -- CONFIG
$ pb image logs pasapples/pbs-demo-image -b 1
papicella@papicella:~$ pb image logs pasapples/pbs-demo-image -b 1
[build-step-credential-initializer] {"level":"info","ts":1564739008.561973,"logger":"fallback-logger","caller":"creds-init/main.go:40","msg":"Credentials initialized.","commit":"002a41a"}
[build-step-credential-initializer]
[build-step-git-source-0] git-init:main.go:81: Successfully cloned "https://github.com/papicella/pbs-demo" @ "c1aae50feaffcd61c521796cd675e6576e58bc64" in path "/workspace"
[build-step-git-source-0]
[build-step-prepare]
[build-step-detect] Trying group 1 out of 3 with 27 buildpacks...
[build-step-detect] ======== Results ========
[build-step-detect] skip: Cloud Foundry Archive Expanding Buildpack
[build-step-detect] pass: Pivotal OpenJDK Buildpack
[build-step-detect] pass: Pivotal Build System Buildpack
[build-step-detect] pass: Cloud Foundry JVM Application Buildpack
[build-step-detect] pass: Cloud Foundry Spring Boot Buildpack
[build-step-detect] pass: Cloud Foundry Apache Tomcat Buildpack
[build-step-detect] pass: Cloud Foundry DistZip Buildpack
[build-step-detect] skip: Cloud Foundry Procfile Buildpack
[build-step-detect] skip: Pivotal AppDynamics Buildpack
[build-step-detect] skip: Pivotal AspectJ Buildpack
[build-step-detect] skip: Pivotal CA Introscope Buildpack
[build-step-detect] pass: Pivotal Client Certificate Mapper Buildpack
....
6. So after a few minutes or so we will see we have built our initial image from the GitHub repo and that OCI compliant image built using Cloud Native Buildpacks is created on our DockerHub account
$ pb image builds pasapples/pbs-demo-image
Build Status Image Started Time Finished Time Reason
----- ------ ----- ------------ ------------- ------
1 SUCCESS 98239112 2019-08-02 09:43:06 2019-08-02 09:44:34 CONFIG
One of the PBS job is to keep this image updated as new successful commits occur off the matser branch. Lets show how this works as per below
7. Let's make a change to the code for or GitHub repo here I do this in IntelliJ IDEA
8. Commit the changes as shown below
9. Let's see if indeed the PBS actually started a new build for us and we should see it is doing that.
$ pb image builds pasapples/pbs-demo-image
Build Status Image Started Time Finished Time Reason
----- ------ ----- ------------ ------------- ------
1 SUCCESS 98239112 2019-08-02 09:43:06 2019-08-02 09:44:34 CONFIG
2 BUILDING -- 2019-08-02 09:57:11 -- COMMIT
10. We can tail the logs as shown below and actually tail the build logs live using "-f"
papicella@papicella:~$ pb image logs pasapples/pbs-demo-image -b 2 -f
[build-step-credential-initializer] {"level":"info","ts":1564739850.5331886,"logger":"fallback-logger","caller":"creds-init/main.go:40","msg":"Credentials initialized.","commit":"002a41a"}
[build-step-credential-initializer]
[build-step-git-source-0] git-init:main.go:81: Successfully cloned "https://github.com/papicella/pbs-demo" @ "0bb81c7523be7ada3ed956569d0241cda6b410d2" in path "/workspace"
[build-step-git-source-0]
[build-step-prepare]
[build-step-detect] Trying group 1 out of 3 with 27 buildpacks...
[build-step-detect] ======== Results ========
[build-step-detect] skip: Cloud Foundry Archive Expanding Buildpack
[build-step-detect] pass: Pivotal OpenJDK Buildpack
[build-step-detect] pass: Pivotal Build System Buildpack
[build-step-detect] pass: Cloud Foundry JVM Application Buildpack
[build-step-detect] pass: Cloud Foundry Spring Boot Buildpack
[build-step-detect] pass: Cloud Foundry Apache Tomcat Buildpack
[build-step-detect] pass: Cloud Foundry DistZip Buildpack
[build-step-detect] skip: Cloud Foundry Procfile Buildpack
[build-step-detect] skip: Pivotal AppDynamics Buildpack
[build-step-detect] skip: Pivotal AspectJ Buildpack
[build-step-detect] skip: Pivotal CA Introscope Buildpack
[build-step-detect] pass: Pivotal Client Certificate Mapper Buildpack
[build-step-detect] skip: Pivotal Elastic APM Buildpack
[build-step-detect] skip: Pivotal JaCoCo Buildpack
[build-step-detect] skip: Pivotal JProfiler Buildpack
[build-step-detect] skip: Pivotal JRebel Buildpack
[build-step-detect] skip: Pivotal New Relic Buildpack
[build-step-detect] skip: Pivotal OverOps Buildpack
[build-step-detect] skip: Pivotal Riverbed AppInternals Buildpack
[build-step-detect] skip: Pivotal SkyWalking Buildpack
[build-step-detect] skip: Pivotal YourKit Buildpack
[build-step-detect] skip: Cloud Foundry Azure Application Insights Buildpack
[build-step-detect] skip: Cloud Foundry Debug Buildpack
[build-step-detect] skip: Cloud Foundry Google Stackdriver Buildpack
[build-step-detect] skip: Cloud Foundry JDBC Buildpack
[build-step-detect] skip: Cloud Foundry JMX Buildpack
[build-step-detect] pass: Cloud Foundry Spring Auto-reconfiguration Buildpack
[build-step-detect]
[build-step-restore] Restoring cached layer 'io.pivotal.openjdk:openjdk-jdk'
[build-step-restore] Restoring cached layer 'io.pivotal.buildsystem:build-system-application'
[build-step-restore] Restoring cached layer 'io.pivotal.buildsystem:build-system-cache'
[build-step-restore] Restoring cached layer 'org.cloudfoundry.jvmapplication:executable-jar'
[build-step-restore] Restoring cached layer 'org.cloudfoundry.springboot:spring-boot'
[build-step-restore]
[build-step-analyze] Analyzing image 'index.docker.io/pasapples/pbs-demo-image@sha256:982391123b47cdbac534aaeed78c5e121d89d2064b53897c23f2248a7658fa50'
[build-step-analyze] Using cached layer 'io.pivotal.openjdk:openjdk-jdk'
[build-step-analyze] Writing metadata for uncached layer 'io.pivotal.openjdk:java-security-properties'
[build-step-analyze] Writing metadata for uncached layer 'io.pivotal.openjdk:jvmkill'
[build-step-analyze] Writing metadata for uncached layer 'io.pivotal.openjdk:link-local-dns'
[build-step-analyze] Writing metadata for uncached layer 'io.pivotal.openjdk:memory-calculator'
[build-step-analyze] Writing metadata for uncached layer 'io.pivotal.openjdk:openjdk-jre'
[build-step-analyze] Writing metadata for uncached layer 'io.pivotal.openjdk:security-provider-configurer'
[build-step-analyze] Writing metadata for uncached layer 'io.pivotal.openjdk:class-counter'
[build-step-analyze] Using cached layer 'io.pivotal.buildsystem:build-system-application'
[build-step-analyze] Using cached layer 'io.pivotal.buildsystem:build-system-cache'
[build-step-analyze] Using cached launch layer 'org.cloudfoundry.jvmapplication:executable-jar'
[build-step-analyze] Rewriting metadata for layer 'org.cloudfoundry.jvmapplication:executable-jar'
[build-step-analyze] Using cached launch layer 'org.cloudfoundry.springboot:spring-boot'
[build-step-analyze] Rewriting metadata for layer 'org.cloudfoundry.springboot:spring-boot'
[build-step-analyze] Writing metadata for uncached layer 'io.pivotal.clientcertificatemapper:client-certificate-mapper'
[build-step-analyze] Writing metadata for uncached layer 'org.cloudfoundry.springautoreconfiguration:auto-reconfiguration'
[build-step-analyze]
[build-step-build]
[build-step-build] Pivotal OpenJDK Buildpack 1.0.0-M9
[build-step-build] OpenJDK JDK 11.0.3: Reusing cached layer
[build-step-build] OpenJDK JRE 11.0.3: Reusing cached layer
[build-step-build] Java Security Properties 1.0.0-M9: Reusing cached layer
[build-step-build] Security Provider Configurer 1.0.0-M9: Reusing cached layer
[build-step-build] Link-Local DNS 1.0.0-M9: Reusing cached layer
[build-step-build] JVMKill Agent 1.16.0: Reusing cached layer
[build-step-build] Class Counter 1.0.0-M9: Reusing cached layer
[build-step-build] Memory Calculator 4.0.0: Reusing cached layer
[build-step-build]
[build-step-build] Pivotal Build System Buildpack 1.0.0-M9
[build-step-build] Using wrapper
[build-step-build] Linking Cache to /home/vcap/.m2
[build-step-build] Compiled Application (141 files): Contributing to layer
[build-step-build] [INFO] Scanning for projects...
[build-step-build] [INFO]
[build-step-build] [INFO] ------------------------< com.example:pbs-demo >------------------------
[build-step-build] [INFO] Building pbs-demo 0.0.1-SNAPSHOT
[build-step-build] [INFO] --------------------------------[ jar ]---------------------------------
[build-step-build] [INFO]
[build-step-build] [INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ pbs-demo ---
[build-step-build] [INFO] Using 'UTF-8' encoding to copy filtered resources.
[build-step-build] [INFO] Copying 1 resource
[build-step-build] [INFO] Copying 0 resource
[build-step-build] [INFO]
[build-step-build] [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ pbs-demo ---
[build-step-build] [INFO] Changes detected - recompiling the module!
[build-step-build] [INFO] Compiling 9 source files to /workspace/target/classes
[build-step-build] [INFO]
[build-step-build] [INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ pbs-demo ---
[build-step-build] [INFO] Not copying test resources
[build-step-build] [INFO]
[build-step-build] [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ pbs-demo ---
[build-step-build] [INFO] Not compiling test sources
[build-step-build] [INFO]
[build-step-build] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ pbs-demo ---
[build-step-build] [INFO] Tests are skipped.
[build-step-build] [INFO]
[build-step-build] [INFO] --- maven-jar-plugin:3.1.2:jar (default-jar) @ pbs-demo ---
[build-step-build] [INFO] Building jar: /workspace/target/pbs-demo-0.0.1-SNAPSHOT.jar
[build-step-build] [INFO]
[build-step-build] [INFO] --- spring-boot-maven-plugin:2.1.6.RELEASE:repackage (repackage) @ pbs-demo ---
[build-step-build] [INFO] Replacing main artifact with repackaged archive
[build-step-build] [INFO] ------------------------------------------------------------------------
[build-step-build] [INFO] BUILD SUCCESS
[build-step-build] [INFO] ------------------------------------------------------------------------
[build-step-build] [INFO] Total time: 7.214 s
[build-step-build] [INFO] Finished at: 2019-08-02T09:57:52Z
[build-step-build] [INFO] ------------------------------------------------------------------------
[build-step-build] Removing source code
[build-step-build]
[build-step-build] Cloud Foundry JVM Application Buildpack 1.0.0-M9
[build-step-build] Executable JAR: Reusing cached layer
[build-step-build] Process types:
[build-step-build] executable-jar: java -cp $CLASSPATH $JAVA_OPTS org.springframework.boot.loader.JarLauncher
[build-step-build] task: java -cp $CLASSPATH $JAVA_OPTS org.springframework.boot.loader.JarLauncher
[build-step-build] web: java -cp $CLASSPATH $JAVA_OPTS org.springframework.boot.loader.JarLauncher
[build-step-build]
[build-step-build] Cloud Foundry Spring Boot Buildpack 1.0.0-M9
[build-step-build] Spring Boot 2.1.6.RELEASE: Reusing cached layer
[build-step-build] Process types:
[build-step-build] spring-boot: java -cp $CLASSPATH $JAVA_OPTS com.example.pbsdemo.PbsDemoApplication
[build-step-build] task: java -cp $CLASSPATH $JAVA_OPTS com.example.pbsdemo.PbsDemoApplication
[build-step-build] web: java -cp $CLASSPATH $JAVA_OPTS com.example.pbsdemo.PbsDemoApplication
[build-step-build]
[build-step-build] Pivotal Client Certificate Mapper Buildpack 1.0.0-M9
[build-step-build] Cloud Foundry Client Certificate Mapper 1.8.0: Reusing cached layer
[build-step-build]
[build-step-build] Cloud Foundry Spring Auto-reconfiguration Buildpack 1.0.0-M9
[build-step-build] Spring Auto-reconfiguration 2.7.0: Reusing cached layer
[build-step-build]
...
11. This time the build will be faster given we are using Cloud Native Buildpacks a CNCF project and it will only rebuild the layers required versus the whole image itself. You can see from the time taken of build "2"
$ pb image builds pasapples/pbs-demo-image
Build Status Image Started Time Finished Time Reason
----- ------ ----- ------------ ------------- ------
1 SUCCESS 98239112 2019-08-02 09:43:06 2019-08-02 09:44:34 CONFIG
2 SUCCESS 1e4b63b1 2019-08-02 09:57:11 2019-08-02 09:58:15 COMMIT
Hopefully this demo shows what the PBS is all about and how it will simplify how you create and keep updated your OCI compliant images.
More Information:
1. Get started with Pivotal Build Service.
https://github.com/pivotal-cf/docs-build-service/blob/master/using.md
2. Request alpha access to Build Service via this form, or by reaching out to your account team. Once you’ve gained access, you’ll see the bits on up PivNet
3. Cloud Native buildpacks
https://buildpacks.io/
Categories: Fusion Middleware
Deploy Artifacts from JFrog Artifactory to PCF directly from IntelliJ IDEA using Spinnaker
Spinnaker is an open-source, multi-cloud continuous delivery platform that helps you release software changes with high velocity and confidence. In the demo below we will show how to deploy an Spring boot application deployed to JFrog Artifactory which Spinnaker watches for changes through a trigger and then deploys to PCF
This demo assumes you have the following:
https://jfrog.com/screencast/setting-maven-repository-jfrog-artifactory-less-one-minute/
In this screen shot below it's shows we are ready to use JFrog Artifactory as our maven repository
Configure Spinnaker1. Connect to Halyard pod as shown below
$ kubectl exec --namespace default -it myspinnaker-spinnaker-halyard-0 bash
2. Enable the Artifactory repository
$ hal config repository artifactory enable
3. Add a search for your repository
$ hal config repository artifactory search add spring-artifactory --base-url http://10.195.75.147/artifactory --repo libs-release-local --groupId com.example --username admin --password
4. Enable the Maven artifact provider
$ hal config artifact maven enable
5. Add an artifact account for Maven
$ hal config artifact maven account add spring-artifactory-maven --repository-url http://10.195.75.147/artifactory/libs-release-local
6. Apply your changes
$ hal deploy apply
Configure Spring Boot Application1. To deploy build artifacts through Artifactory you need to add a deployment element with the URL of a target local repository to which you want to deploy your artifacts. You can find this in the "Set Me Up " wizard for your maven repository in JFrog Artifactory
2. Copy the pom.xml entry and place into your local maven project POM file as shown below
Basic Spring Boot project as follows for this:
Configure Spinnaker Pipeline1. Create a new pipeline for your application. In the pipeline configuration, add an Artifactory trigger to the Automated Triggers, as shown below. We are referencing what we created above in Spinnaker
2. In the Artifact Constraints dropdown for the Artifactory trigger, select “Define a new artifact…” and populate the Expected Artifact form with the details of the artifact that will be published to the Artifactory repository
3. Add a “Deploy” stage to the pipeline which will simply just deploy our application to PCF.
Now we are ready to Publish the application artifact to the Artifactory repository
Kick if offTo verify our setup we just need to do a "mvn deploy" from the local spring boot maven project as shown below
1. Deploy the artifact JAR using "mvn deploy" as shown below from your local maven project which will publish the artifact to your JFrog Artifactory maven repo.
$ mvn deploy
Output from command above
[INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) @ spinnaker-artifactory-demo ---
Uploading to central: http://10.195.75.147:80/artifactory/libs-release-local/com/example/spinnaker-artifactory-demo/0.0.1-RELEASE/spinnaker-artifactory-demo-0.0.1-RELEASE.jar
Uploaded to central: http://10.195.75.147:80/artifactory/libs-release-local/com/example/spinnaker-artifactory-demo/0.0.1-RELEASE/spinnaker-artifactory-demo-0.0.1-RELEASE.jar (17 MB at 83 kB/s)
Uploading to central: http://10.195.75.147:80/artifactory/libs-release-local/com/example/spinnaker-artifactory-demo/0.0.1-RELEASE/spinnaker-artifactory-demo-0.0.1-RELEASE.pom
Uploaded to central: http://10.195.75.147:80/artifactory/libs-release-local/com/example/spinnaker-artifactory-demo/0.0.1-RELEASE/spinnaker-artifactory-demo-0.0.1-RELEASE.pom (1.8 kB at 886 B/s)
Downloading from central: http://10.195.75.147:80/artifactory/libs-release-local/com/example/spinnaker-artifactory-demo/maven-metadata.xml
Downloaded from central: http://10.195.75.147:80/artifactory/libs-release-local/com/example/spinnaker-artifactory-demo/maven-metadata.xml (424 B at 671 B/s)
Uploading to central: http://10.195.75.147:80/artifactory/libs-release-local/com/example/spinnaker-artifactory-demo/maven-metadata.xml
Uploaded to central: http://10.195.75.147:80/artifactory/libs-release-local/com/example/spinnaker-artifactory-demo/maven-metadata.xml (368 B at 218 B/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:33 min
[INFO] Finished at: 2019-06-28T09:59:00+10:00
[INFO] ------------------------------------------------------------------------
2. Verify from spinnaker that your artifactory trigger has fired
3. From PCF applications manager we will see our deployed application using the server group settings we used and the artifactory published JAR we used
4. Once pipeline is complete you can view information of what was created and the various stages as shown below
More InformationDeploy Artifacts from Artifactory to CF
https://www.spinnaker.io/guides/tutorials/codelabs/artifactory-to-cf/
This demo assumes you have the following:
- A JFrog Artifactory repository configured to accept a Maven artifact—the JAR for your application (Spring Boot JAR in this example)
- Spinnaker 1.14.7 or later installed on a k8s cluster
https://jfrog.com/screencast/setting-maven-repository-jfrog-artifactory-less-one-minute/
In this screen shot below it's shows we are ready to use JFrog Artifactory as our maven repository
Configure Spinnaker1. Connect to Halyard pod as shown below
$ kubectl exec --namespace default -it myspinnaker-spinnaker-halyard-0 bash
2. Enable the Artifactory repository
$ hal config repository artifactory enable
3. Add a search for your repository
$ hal config repository artifactory search add spring-artifactory --base-url http://10.195.75.147/artifactory --repo libs-release-local --groupId com.example --username admin --password
$ hal config artifact maven enable
5. Add an artifact account for Maven
$ hal config artifact maven account add spring-artifactory-maven --repository-url http://10.195.75.147/artifactory/libs-release-local
$ hal deploy apply
Configure Spring Boot Application1. To deploy build artifacts through Artifactory you need to add a deployment element with the URL of a target local repository to which you want to deploy your artifacts. You can find this in the "Set Me Up " wizard for your maven repository in JFrog Artifactory
2. Copy the pom.xml entry and place into your local maven project POM file as shown below
<distributionManagement>
<repository>
<id>central</id>
<name>artifactory-artifactory-0-releases</name>
<url>http://10.195.75.147:80/artifactory/libs-release-local</url>
</repository>
</distributionManagement>
Basic Spring Boot project as follows for this:
Configure Spinnaker Pipeline1. Create a new pipeline for your application. In the pipeline configuration, add an Artifactory trigger to the Automated Triggers, as shown below. We are referencing what we created above in Spinnaker
2. In the Artifact Constraints dropdown for the Artifactory trigger, select “Define a new artifact…” and populate the Expected Artifact form with the details of the artifact that will be published to the Artifactory repository
3. Add a “Deploy” stage to the pipeline which will simply just deploy our application to PCF.
Now we are ready to Publish the application artifact to the Artifactory repository
Kick if offTo verify our setup we just need to do a "mvn deploy" from the local spring boot maven project as shown below
1. Deploy the artifact JAR using "mvn deploy" as shown below from your local maven project which will publish the artifact to your JFrog Artifactory maven repo.
$ mvn deploy
Output from command above
[INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) @ spinnaker-artifactory-demo ---
Uploading to central: http://10.195.75.147:80/artifactory/libs-release-local/com/example/spinnaker-artifactory-demo/0.0.1-RELEASE/spinnaker-artifactory-demo-0.0.1-RELEASE.jar
Uploaded to central: http://10.195.75.147:80/artifactory/libs-release-local/com/example/spinnaker-artifactory-demo/0.0.1-RELEASE/spinnaker-artifactory-demo-0.0.1-RELEASE.jar (17 MB at 83 kB/s)
Uploading to central: http://10.195.75.147:80/artifactory/libs-release-local/com/example/spinnaker-artifactory-demo/0.0.1-RELEASE/spinnaker-artifactory-demo-0.0.1-RELEASE.pom
Uploaded to central: http://10.195.75.147:80/artifactory/libs-release-local/com/example/spinnaker-artifactory-demo/0.0.1-RELEASE/spinnaker-artifactory-demo-0.0.1-RELEASE.pom (1.8 kB at 886 B/s)
Downloading from central: http://10.195.75.147:80/artifactory/libs-release-local/com/example/spinnaker-artifactory-demo/maven-metadata.xml
Downloaded from central: http://10.195.75.147:80/artifactory/libs-release-local/com/example/spinnaker-artifactory-demo/maven-metadata.xml (424 B at 671 B/s)
Uploading to central: http://10.195.75.147:80/artifactory/libs-release-local/com/example/spinnaker-artifactory-demo/maven-metadata.xml
Uploaded to central: http://10.195.75.147:80/artifactory/libs-release-local/com/example/spinnaker-artifactory-demo/maven-metadata.xml (368 B at 218 B/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:33 min
[INFO] Finished at: 2019-06-28T09:59:00+10:00
[INFO] ------------------------------------------------------------------------
2. Verify from spinnaker that your artifactory trigger has fired
3. From PCF applications manager we will see our deployed application using the server group settings we used and the artifactory published JAR we used
4. Once pipeline is complete you can view information of what was created and the various stages as shown below
More InformationDeploy Artifacts from Artifactory to CF
https://www.spinnaker.io/guides/tutorials/codelabs/artifactory-to-cf/
Categories: Fusion Middleware
Using Cloud Native Buildpacks (CNB) on a local registry to speed up the building of images for test purposes
I previously blogged about the CNCF project known as Cloud Native Buildpacks previously on this blog entry below.
Building PivotalMySQLWeb using Cloud Native Buildpacks (CNB)
http://theblasfrompas.blogspot.com/2019/06/building-pivotalmysqlweb-using-cloud.html
In the steps below I will show how to use a local docker registry on your laptop or desktop to enable faster builds of your OCI compliant images using CNB's. Here is how using the same application.
Pre Steps:
1. Ensure you have Docker CE installed if not use this link
https://hub.docker.com/search/?type=edition&offering=community
Steps:
1. Start by running a local registry on your own laptop. The guide shows how to get a container running which will be our local registry and then how you verify it's running.
https://docs.docker.com/registry/
$ docker run -d -p 5000:5000 --restart=always --name registry registry:2
Verify it's running:
$ netstat -an | grep 5000
tcp6 0 0 ::1.5000 *.* LISTEN
tcp4 0 0 *.5000 *.* LISTEN
2. Then pull the CNB images versions of the "official" build and run images from the GCR as follows. Those images exist here
https://console.cloud.google.com/gcr/images/cncf-buildpacks-ci/GLOBAL/packs/run?gcrImageListsize=30
Here I am using the latest build/run images which at the time of this post was "run:0.2.0-build.12"
papicella@papicella:~$ docker pull gcr.io:443/cncf-buildpacks-ci/packs/run:0.2.0-build.12
0.2.0-build.12: Pulling from cncf-buildpacks-ci/packs/run
Digest: sha256:ebd42c0228f776804f2e99733076216592c5a1117f1b3dde7688cf3bd0bbe7b9
Status: Downloaded newer image for gcr.io:443/cncf-buildpacks-ci/packs/run:0.2.0-build.12
papicella@papicella:~$ docker tag gcr.io:443/cncf-buildpacks-ci/packs/run:0.2.0-build.12 localhost:5000/run:0.2.0-build.12
papicella@papicella:~$ docker rmi gcr.io:443/cncf-buildpacks-ci/packs/run:0.2.0-build.12
Untagged: gcr.io:443/cncf-buildpacks-ci/packs/run:0.2.0-build.12
Untagged: gcr.io:443/cncf-buildpacks-ci/packs/run@sha256:ebd42c0228f776804f2e99733076216592c5a1117f1b3dde7688cf3bd0bbe7b9
papicella@papicella:~$ docker push localhost:5000/run:0.2.0-build.12
The push refers to repository [localhost:5000/run]
1315c94f2536: Layer already exists
63696cbb6c17: Layer already exists
30ede08f8231: Layer already exists
b57c79f4a9f3: Layer already exists
d60e01b37e74: Layer already exists
e45cfbc98a50: Layer already exists
762d8e1a6054: Layer already exists
0.2.0-build.12: digest: sha256:ebd42c0228f776804f2e99733076216592c5a1117f1b3dde7688cf3bd0bbe7b9 size: 1780
3. Now lets use our local registry and build/run images which will be much faster for local development
papicella@papicella:~/pivotal/PCF/APJ/PPTX/CNCF/buildpacks.io/demos$ docker tag localhost:5000/run:0.2.0-build.12 localhost:5000/run
papicella@papicella:~/pivotal/PCF/APJ/PPTX/CNCF/buildpacks.io/demos$ docker push localhost:5000/run:latest
The push refers to repository [localhost:5000/run]
1315c94f2536: Layer already exists
63696cbb6c17: Layer already exists
30ede08f8231: Layer already exists
b57c79f4a9f3: Layer already exists
d60e01b37e74: Layer already exists
e45cfbc98a50: Layer already exists
762d8e1a6054: Layer already exists
latest: digest: sha256:ebd42c0228f776804f2e99733076216592c5a1117f1b3dde7688cf3bd0bbe7b9 size: 1780
papicella@papicella:~/pivotal/PCF/APJ/PPTX/CNCF/buildpacks.io/demos$ pack build localhost:5000/pivotal-mysql-web --path ./PivotalMySQLWeb --no-pull --publish
Using default builder image cloudfoundry/cnb:cflinuxfs3
Selected run image cloudfoundry/cnb-run:cflinuxfs3 from builder
Using build cache volume pack-cache-65bb470893c1.build
Executing lifecycle version 0.2.1
===> DETECTING
[detector] Trying group 1 out of 4 with 8 buildpacks...
[detector] ======== Results ========
[detector] pass: Cloud Foundry OpenJDK Buildpack
[detector] skip: Cloud Foundry Build System Buildpack
[detector] pass: Cloud Foundry JVM Application Buildpack
[detector] skip: Cloud Foundry Azure Application Insights Buildpack
[detector] skip: Cloud Foundry Debug Buildpack
[detector] skip: Cloud Foundry Google Stackdriver Buildpack
[detector] skip: Cloud Foundry JMX Buildpack
[detector] skip: Cloud Foundry Procfile Buildpack
===> RESTORING
[restorer] restoring cached layer 'org.cloudfoundry.openjdk:d2df8bc799b09c8375f79bf646747afac3d933bb1f65de71d6c78e7466ff8fe4'
===> ANALYZING
[analyzer] using cached layer 'org.cloudfoundry.openjdk:d2df8bc799b09c8375f79bf646747afac3d933bb1f65de71d6c78e7466ff8fe4'
[analyzer] writing metadata for uncached layer 'org.cloudfoundry.openjdk:openjdk-jre'
[analyzer] writing metadata for uncached layer 'org.cloudfoundry.jvmapplication:main-class'
===> BUILDING
[builder] -----> Cloud Foundry OpenJDK Buildpack 1.0.0-M8
[builder] -----> OpenJDK JRE 11.0.3: Reusing cached layer
[builder]
[builder] -----> Cloud Foundry JVM Application Buildpack 1.0.0-M8
[builder] -----> Main-Class Classpath: Reusing cached layer
[builder] -----> Process types:
[builder] task: java -cp $CLASSPATH $JAVA_OPTS org.springframework.boot.loader.JarLauncher
[builder] web: java -cp $CLASSPATH $JAVA_OPTS org.springframework.boot.loader.JarLauncher
[builder]
===> EXPORTING
[exporter] Reusing layer 'app' with SHA sha256:b32618ed6b86fb496a4ce33db9df49fdd4ef16c5646b174b5643c8befcb7408a
[exporter] Reusing layer 'config' with SHA sha256:9538e967fa10f23b3415c382a3754ebf4c2645c20b6d76af519236c1181e7639
[exporter] Reusing layer 'launcher' with SHA sha256:04ca7957074763290a9abe6a067ce8c902a2ab51ed6c55102964e3f3294cdebd
[exporter] Reusing layer 'org.cloudfoundry.openjdk:openjdk-jre' with SHA sha256:e540f1464509ac673a25bd2f24c7dd6875f805c0dd35e9af84dd4669e2fd0c93
[exporter] Reusing layer 'org.cloudfoundry.jvmapplication:main-class' with SHA sha256:8537197b3f57d86a59397b89b4fbdd14900a602cc12961eae338b9ef2513cdc0
[exporter]
[exporter] *** Image: localhost:5000/pivotal-mysql-web:latest@sha256:f1d7a25fc5159ceb668c26b595dcffb00ef54ada31cbb52eaa8319dc143fc9d8
===> CACHING
[cacher] Reusing layer 'org.cloudfoundry.openjdk:d2df8bc799b09c8375f79bf646747afac3d933bb1f65de71d6c78e7466ff8fe4' with SHA sha256:11439713b023be71211cb83ecd56a1be63e0c0be3e4814a18cc4c71d2264dea5
Successfully built image localhost:5000/pivotal-mysql-web
papicella@papicella:~/pivotal/PCF/APJ/PPTX/CNCF/buildpacks.io/demos$ docker pull localhost:5000/pivotal-mysql-web
Using default tag: latest
latest: Pulling from pivotal-mysql-web
410238d178d0: Already exists
a00e90b544bc: Already exists
9de264eecc08: Already exists
4acedf754175: Already exists
d5a72fc0c7a1: Already exists
4066d2d744ac: Already exists
dba1ef680b99: Already exists
Digest: sha256:f1d7a25fc5159ceb668c26b595dcffb00ef54ada31cbb52eaa8319dc143fc9d8
Status: Downloaded newer image for localhost:5000/pivotal-mysql-web:latest
papicella@papicella:~/pivotal/PCF/APJ/PPTX/CNCF/buildpacks.io/demos$ docker run -m 1G -p 8080:8080 localhost:5000/pivotal-mysql-web
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.0.RELEASE)
2019-06-12 01:02:16.174 INFO 1 --- [ main] c.p.p.m.PivotalMySqlWebApplication : Starting PivotalMySqlWebApplication on a018f17d6121 with PID 1 (/workspace/BOOT-INF/classes started by vcap in /workspace)
2019-06-12 01:02:16.179 INFO 1 --- [ main] c.p.p.m.PivotalMySqlWebApplication : No active profile set, falling back to default profiles: default
2019-06-12 01:02:18.336 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-06-12 01:02:18.374 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-06-12 01:02:18.375 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/9.0.12
2019-06-12 01:02:18.391 INFO 1 --- [ main] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/layers/org.cloudfoundry.openjdk/openjdk-jre/lib:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib]
2019-06-12 01:02:18.512 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-06-12 01:02:18.512 INFO 1 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2270 ms
2019-06-12 01:02:19.019 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2019-06-12 01:02:19.020 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webMvcMetricsFilter' to: [/*]
2019-06-12 01:02:19.020 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2019-06-12 01:02:19.020 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'formContentFilter' to: [/*]
2019-06-12 01:02:19.021 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2019-06-12 01:02:19.021 INFO 1 --- [ main] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2019-06-12 01:02:19.022 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpTraceFilter' to: [/*]
2019-06-12 01:02:19.022 INFO 1 --- [ main] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2019-06-12 01:02:19.374 INFO 1 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-06-12 01:02:19.918 INFO 1 --- [ main] .s.s.UserDetailsServiceAutoConfiguration :
Using generated security password: 42d4ec01-6459-4205-a66b-1b49d333121e
2019-06-12 01:02:20.043 INFO 1 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: Ant [pattern='/**'], []
2019-06-12 01:02:20.092 INFO 1 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@47e4d9d0, org.springframework.security.web.context.SecurityContextPersistenceFilter@5e4fa1da, org.springframework.security.web.header.HeaderWriterFilter@4ae263bf, org.springframework.security.web.csrf.CsrfFilter@2788d0fe, org.springframework.security.web.authentication.logout.LogoutFilter@15fdd1f2, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@2d746ce4, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter@70e02081, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter@49798e84, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@1948ea69, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@3f92c349, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@66ba7e45, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@6ed06f69, org.springframework.security.web.session.SessionManagementFilter@19ccca5, org.springframework.security.web.access.ExceptionTranslationFilter@57aa341b, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@7c6442c2]
2019-06-12 01:02:20.138 INFO 1 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 9 endpoint(s) beneath base path '/actuator'
2019-06-12 01:02:20.259 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2019-06-12 01:02:20.265 INFO 1 --- [ main] c.p.p.m.PivotalMySqlWebApplication : Started PivotalMySqlWebApplication in 4.841 seconds (JVM running for 5.646)
And that's it a locally built OCI image (Built very fast all locally) you have run locally from your local image registry.
Here is how to view your local registry using HTTPie showing our locally built "pivotal-mysql-web" OCI image we created above
papicella@papicella:~$ http http://localhost:5000/v2/_catalog
HTTP/1.1 200 OK
Content-Length: 63
Content-Type: application/json; charset=utf-8
Date: Wed, 12 Jun 2019 01:53:40 GMT
Docker-Distribution-Api-Version: registry/2.0
X-Content-Type-Options: nosniff
{
"repositories": [
"pivotal-mysql-web",
"run",
"sample-java-app"
]
}
More Information
1. Cloud Native Buildpacks: an Industry-Standard Build Process for Kubernetes and Beyond.
https://content.pivotal.io/blog/cloud-native-buildpacks-for-kubernetes-and-beyond
2. buildspacks.io Home Page
https://buildpacks.io/
Building PivotalMySQLWeb using Cloud Native Buildpacks (CNB)
http://theblasfrompas.blogspot.com/2019/06/building-pivotalmysqlweb-using-cloud.html
In the steps below I will show how to use a local docker registry on your laptop or desktop to enable faster builds of your OCI compliant images using CNB's. Here is how using the same application.
Pre Steps:
1. Ensure you have Docker CE installed if not use this link
https://hub.docker.com/search/?type=edition&offering=community
Steps:
1. Start by running a local registry on your own laptop. The guide shows how to get a container running which will be our local registry and then how you verify it's running.
https://docs.docker.com/registry/
$ docker run -d -p 5000:5000 --restart=always --name registry registry:2
Verify it's running:
$ netstat -an | grep 5000
tcp6 0 0 ::1.5000 *.* LISTEN
tcp4 0 0 *.5000 *.* LISTEN
2. Then pull the CNB images versions of the "official" build and run images from the GCR as follows. Those images exist here
https://console.cloud.google.com/gcr/images/cncf-buildpacks-ci/GLOBAL/packs/run?gcrImageListsize=30
Here I am using the latest build/run images which at the time of this post was "run:0.2.0-build.12"
papicella@papicella:~$ docker pull gcr.io:443/cncf-buildpacks-ci/packs/run:0.2.0-build.12
0.2.0-build.12: Pulling from cncf-buildpacks-ci/packs/run
Digest: sha256:ebd42c0228f776804f2e99733076216592c5a1117f1b3dde7688cf3bd0bbe7b9
Status: Downloaded newer image for gcr.io:443/cncf-buildpacks-ci/packs/run:0.2.0-build.12
papicella@papicella:~$ docker tag gcr.io:443/cncf-buildpacks-ci/packs/run:0.2.0-build.12 localhost:5000/run:0.2.0-build.12
papicella@papicella:~$ docker rmi gcr.io:443/cncf-buildpacks-ci/packs/run:0.2.0-build.12
Untagged: gcr.io:443/cncf-buildpacks-ci/packs/run:0.2.0-build.12
Untagged: gcr.io:443/cncf-buildpacks-ci/packs/run@sha256:ebd42c0228f776804f2e99733076216592c5a1117f1b3dde7688cf3bd0bbe7b9
papicella@papicella:~$ docker push localhost:5000/run:0.2.0-build.12
The push refers to repository [localhost:5000/run]
1315c94f2536: Layer already exists
63696cbb6c17: Layer already exists
30ede08f8231: Layer already exists
b57c79f4a9f3: Layer already exists
d60e01b37e74: Layer already exists
e45cfbc98a50: Layer already exists
762d8e1a6054: Layer already exists
0.2.0-build.12: digest: sha256:ebd42c0228f776804f2e99733076216592c5a1117f1b3dde7688cf3bd0bbe7b9 size: 1780
3. Now lets use our local registry and build/run images which will be much faster for local development
papicella@papicella:~/pivotal/PCF/APJ/PPTX/CNCF/buildpacks.io/demos$ docker tag localhost:5000/run:0.2.0-build.12 localhost:5000/run
papicella@papicella:~/pivotal/PCF/APJ/PPTX/CNCF/buildpacks.io/demos$ docker push localhost:5000/run:latest
The push refers to repository [localhost:5000/run]
1315c94f2536: Layer already exists
63696cbb6c17: Layer already exists
30ede08f8231: Layer already exists
b57c79f4a9f3: Layer already exists
d60e01b37e74: Layer already exists
e45cfbc98a50: Layer already exists
762d8e1a6054: Layer already exists
latest: digest: sha256:ebd42c0228f776804f2e99733076216592c5a1117f1b3dde7688cf3bd0bbe7b9 size: 1780
papicella@papicella:~/pivotal/PCF/APJ/PPTX/CNCF/buildpacks.io/demos$ pack build localhost:5000/pivotal-mysql-web --path ./PivotalMySQLWeb --no-pull --publish
Using default builder image cloudfoundry/cnb:cflinuxfs3
Selected run image cloudfoundry/cnb-run:cflinuxfs3 from builder
Using build cache volume pack-cache-65bb470893c1.build
Executing lifecycle version 0.2.1
===> DETECTING
[detector] Trying group 1 out of 4 with 8 buildpacks...
[detector] ======== Results ========
[detector] pass: Cloud Foundry OpenJDK Buildpack
[detector] skip: Cloud Foundry Build System Buildpack
[detector] pass: Cloud Foundry JVM Application Buildpack
[detector] skip: Cloud Foundry Azure Application Insights Buildpack
[detector] skip: Cloud Foundry Debug Buildpack
[detector] skip: Cloud Foundry Google Stackdriver Buildpack
[detector] skip: Cloud Foundry JMX Buildpack
[detector] skip: Cloud Foundry Procfile Buildpack
===> RESTORING
[restorer] restoring cached layer 'org.cloudfoundry.openjdk:d2df8bc799b09c8375f79bf646747afac3d933bb1f65de71d6c78e7466ff8fe4'
===> ANALYZING
[analyzer] using cached layer 'org.cloudfoundry.openjdk:d2df8bc799b09c8375f79bf646747afac3d933bb1f65de71d6c78e7466ff8fe4'
[analyzer] writing metadata for uncached layer 'org.cloudfoundry.openjdk:openjdk-jre'
[analyzer] writing metadata for uncached layer 'org.cloudfoundry.jvmapplication:main-class'
===> BUILDING
[builder] -----> Cloud Foundry OpenJDK Buildpack 1.0.0-M8
[builder] -----> OpenJDK JRE 11.0.3: Reusing cached layer
[builder]
[builder] -----> Cloud Foundry JVM Application Buildpack 1.0.0-M8
[builder] -----> Main-Class Classpath: Reusing cached layer
[builder] -----> Process types:
[builder] task: java -cp $CLASSPATH $JAVA_OPTS org.springframework.boot.loader.JarLauncher
[builder] web: java -cp $CLASSPATH $JAVA_OPTS org.springframework.boot.loader.JarLauncher
[builder]
===> EXPORTING
[exporter] Reusing layer 'app' with SHA sha256:b32618ed6b86fb496a4ce33db9df49fdd4ef16c5646b174b5643c8befcb7408a
[exporter] Reusing layer 'config' with SHA sha256:9538e967fa10f23b3415c382a3754ebf4c2645c20b6d76af519236c1181e7639
[exporter] Reusing layer 'launcher' with SHA sha256:04ca7957074763290a9abe6a067ce8c902a2ab51ed6c55102964e3f3294cdebd
[exporter] Reusing layer 'org.cloudfoundry.openjdk:openjdk-jre' with SHA sha256:e540f1464509ac673a25bd2f24c7dd6875f805c0dd35e9af84dd4669e2fd0c93
[exporter] Reusing layer 'org.cloudfoundry.jvmapplication:main-class' with SHA sha256:8537197b3f57d86a59397b89b4fbdd14900a602cc12961eae338b9ef2513cdc0
[exporter]
[exporter] *** Image: localhost:5000/pivotal-mysql-web:latest@sha256:f1d7a25fc5159ceb668c26b595dcffb00ef54ada31cbb52eaa8319dc143fc9d8
===> CACHING
[cacher] Reusing layer 'org.cloudfoundry.openjdk:d2df8bc799b09c8375f79bf646747afac3d933bb1f65de71d6c78e7466ff8fe4' with SHA sha256:11439713b023be71211cb83ecd56a1be63e0c0be3e4814a18cc4c71d2264dea5
Successfully built image localhost:5000/pivotal-mysql-web
papicella@papicella:~/pivotal/PCF/APJ/PPTX/CNCF/buildpacks.io/demos$ docker pull localhost:5000/pivotal-mysql-web
Using default tag: latest
latest: Pulling from pivotal-mysql-web
410238d178d0: Already exists
a00e90b544bc: Already exists
9de264eecc08: Already exists
4acedf754175: Already exists
d5a72fc0c7a1: Already exists
4066d2d744ac: Already exists
dba1ef680b99: Already exists
Digest: sha256:f1d7a25fc5159ceb668c26b595dcffb00ef54ada31cbb52eaa8319dc143fc9d8
Status: Downloaded newer image for localhost:5000/pivotal-mysql-web:latest
papicella@papicella:~/pivotal/PCF/APJ/PPTX/CNCF/buildpacks.io/demos$ docker run -m 1G -p 8080:8080 localhost:5000/pivotal-mysql-web
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.0.RELEASE)
2019-06-12 01:02:16.174 INFO 1 --- [ main] c.p.p.m.PivotalMySqlWebApplication : Starting PivotalMySqlWebApplication on a018f17d6121 with PID 1 (/workspace/BOOT-INF/classes started by vcap in /workspace)
2019-06-12 01:02:16.179 INFO 1 --- [ main] c.p.p.m.PivotalMySqlWebApplication : No active profile set, falling back to default profiles: default
2019-06-12 01:02:18.336 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-06-12 01:02:18.374 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-06-12 01:02:18.375 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/9.0.12
2019-06-12 01:02:18.391 INFO 1 --- [ main] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/layers/org.cloudfoundry.openjdk/openjdk-jre/lib:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib]
2019-06-12 01:02:18.512 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-06-12 01:02:18.512 INFO 1 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2270 ms
2019-06-12 01:02:19.019 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2019-06-12 01:02:19.020 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webMvcMetricsFilter' to: [/*]
2019-06-12 01:02:19.020 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2019-06-12 01:02:19.020 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'formContentFilter' to: [/*]
2019-06-12 01:02:19.021 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2019-06-12 01:02:19.021 INFO 1 --- [ main] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2019-06-12 01:02:19.022 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpTraceFilter' to: [/*]
2019-06-12 01:02:19.022 INFO 1 --- [ main] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2019-06-12 01:02:19.374 INFO 1 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-06-12 01:02:19.918 INFO 1 --- [ main] .s.s.UserDetailsServiceAutoConfiguration :
Using generated security password: 42d4ec01-6459-4205-a66b-1b49d333121e
2019-06-12 01:02:20.043 INFO 1 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: Ant [pattern='/**'], []
2019-06-12 01:02:20.092 INFO 1 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@47e4d9d0, org.springframework.security.web.context.SecurityContextPersistenceFilter@5e4fa1da, org.springframework.security.web.header.HeaderWriterFilter@4ae263bf, org.springframework.security.web.csrf.CsrfFilter@2788d0fe, org.springframework.security.web.authentication.logout.LogoutFilter@15fdd1f2, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@2d746ce4, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter@70e02081, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter@49798e84, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@1948ea69, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@3f92c349, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@66ba7e45, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@6ed06f69, org.springframework.security.web.session.SessionManagementFilter@19ccca5, org.springframework.security.web.access.ExceptionTranslationFilter@57aa341b, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@7c6442c2]
2019-06-12 01:02:20.138 INFO 1 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 9 endpoint(s) beneath base path '/actuator'
2019-06-12 01:02:20.259 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2019-06-12 01:02:20.265 INFO 1 --- [ main] c.p.p.m.PivotalMySqlWebApplication : Started PivotalMySqlWebApplication in 4.841 seconds (JVM running for 5.646)
And that's it a locally built OCI image (Built very fast all locally) you have run locally from your local image registry.
Here is how to view your local registry using HTTPie showing our locally built "pivotal-mysql-web" OCI image we created above
papicella@papicella:~$ http http://localhost:5000/v2/_catalog
HTTP/1.1 200 OK
Content-Length: 63
Content-Type: application/json; charset=utf-8
Date: Wed, 12 Jun 2019 01:53:40 GMT
Docker-Distribution-Api-Version: registry/2.0
X-Content-Type-Options: nosniff
{
"repositories": [
"pivotal-mysql-web",
"run",
"sample-java-app"
]
}
More Information
1. Cloud Native Buildpacks: an Industry-Standard Build Process for Kubernetes and Beyond.
https://content.pivotal.io/blog/cloud-native-buildpacks-for-kubernetes-and-beyond
2. buildspacks.io Home Page
https://buildpacks.io/
Categories: Fusion Middleware
Building PivotalMySQLWeb using Cloud Native Buildpacks (CNB)
Not heard of Cloud Native Buildpacks? If not this post will show why you might want to. If you want to make your developers more productive with Kubernetes, you’re going to want to look at Cloud Native Buildpacks.
https://buildpacks.io/
Until cloud platforms such as Heroku and Pivotal Cloud Foundry incorporate the Buildpack v3 Lifecycle, the fastest way to try Cloud Native Buildpacks is via the pack CLI, which integrates with your local Docker daemon. Here is an example below taking Pivotal MySQLWeb application and creating an OCI compliant image from that
Pre Steps:
1. Install pack using this link
https://buildpacks.io/docs/install-pack/
2. Ensure you have Docker CE installed if not use this link
https://hub.docker.com/search/?type=edition&offering=community
Steps:
1. I am using Pivotal MySQLWeb which i have packaged using maven and then taken the JAR and exploded it onto the file system to avoid compilation. You can still just use source code and the Cloud Native Buildpack's will still work but in this example I avoid the maven compilation step by using an exploded JAR file already compiled which is what a Build Service on a cloud platform would do in any case
Let's start by using "pack" to create our image as per below
papicella@papicella:~/pivotal/PCF/APJ/PPTX/CNCF/buildpacks.io/demos$ pack build pivotal-mysql-web --path ./PivotalMySQLWeb
Using default builder image cloudfoundry/cnb:cflinuxfs3
Pulling image index.docker.io/cloudfoundry/cnb:cflinuxfs3
cflinuxfs3: Pulling from cloudfoundry/cnb
18d7ea8d445c: Pull complete
18d0be9dc457: Pull complete
f5407c34df38: Pull complete
35c61e03e6bf: Pull complete
40d144c93ada: Pull complete
4f4fb700ef54: Pull complete
0432ec3bb9f8: Pull complete
3731e128636c: Pull complete
1bab066bbafe: Pull complete
4cc53e89f635: Pull complete
4fd62e90f994: Pull complete
dc9fa77b2cd2: Pull complete
3cd4ed6e9bbf: Pull complete
a525f8221dc8: Pull complete
f01bc40f59c5: Pull complete
1f9842b1696d: Pull complete
3e15eeb884d5: Pull complete
3c0f59c7956f: Pull complete
c3e6214340d9: Pull complete
6955f2c8bfad: Pull complete
5112994886a0: Pull complete
e19195f86112: Pull complete
07fb5cd454f2: Pull complete
Digest: sha256:197439e9ccc699daa6431bd7154c80b3b0ce75b072792a0e93edd6779756f3bc
Status: Downloaded newer image for cloudfoundry/cnb:cflinuxfs3
Selected run image cloudfoundry/cnb-run:cflinuxfs3 from builder
Pulling image cloudfoundry/cnb-run:cflinuxfs3
cflinuxfs3: Pulling from cloudfoundry/cnb-run
0a25bf28c5eb: Pull complete
7216becd0525: Pull complete
Digest: sha256:f9605c5af04b2ba04918879f2bf9d37c55620ae28e73b94e9926cd97bbf8fe96
Status: Downloaded newer image for cloudfoundry/cnb-run:cflinuxfs3
Using build cache volume pack-cache-1f2556cf858e.build
Executing lifecycle version 0.2.1
===> DETECTING
[detector] Trying group 1 out of 4 with 8 buildpacks...
[detector] ======== Results ========
[detector] pass: Cloud Foundry OpenJDK Buildpack
[detector] skip: Cloud Foundry Build System Buildpack
[detector] pass: Cloud Foundry JVM Application Buildpack
[detector] skip: Cloud Foundry Azure Application Insights Buildpack
[detector] skip: Cloud Foundry Debug Buildpack
[detector] skip: Cloud Foundry Google Stackdriver Buildpack
[detector] skip: Cloud Foundry JMX Buildpack
[detector] skip: Cloud Foundry Procfile Buildpack
===> RESTORING
[restorer] cache '/cache': metadata not found, nothing to restore
===> ANALYZING
===> BUILDING
[builder] -----> Cloud Foundry OpenJDK Buildpack 1.0.0-M8
[builder] -----> OpenJDK JRE 11.0.3: Contributing to layer
[builder] Downloading from https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U-jre_x64_linux_hotspot_11.0.3_7.tar.gz
[builder] Verifying checksum
[builder] Expanding to /layers/org.cloudfoundry.openjdk/openjdk-jre
[builder] Writing JAVA_HOME to shared
[builder]
[builder] -----> Cloud Foundry JVM Application Buildpack 1.0.0-M8
[builder] -----> Main-Class Classpath: Contributing to layer
[builder] Writing CLASSPATH to launch
[builder] -----> Process types:
[builder] task: java -cp $CLASSPATH $JAVA_OPTS org.springframework.boot.loader.JarLauncher
[builder] web: java -cp $CLASSPATH $JAVA_OPTS org.springframework.boot.loader.JarLauncher
[builder]
===> EXPORTING
[exporter] Exporting layer 'app' with SHA sha256:b32618ed6b86fb496a4ce33db9df49fdd4ef16c5646b174b5643c8befcb7408a
[exporter] Exporting layer 'config' with SHA sha256:9538e967fa10f23b3415c382a3754ebf4c2645c20b6d76af519236c1181e7639
[exporter] Exporting layer 'launcher' with SHA sha256:04ca7957074763290a9abe6a067ce8c902a2ab51ed6c55102964e3f3294cdebd
[exporter] Exporting layer 'org.cloudfoundry.openjdk:openjdk-jre' with SHA sha256:e540f1464509ac673a25bd2f24c7dd6875f805c0dd35e9af84dd4669e2fd0c93
[exporter] Exporting layer 'org.cloudfoundry.jvmapplication:main-class' with SHA sha256:8537197b3f57d86a59397b89b4fbdd14900a602cc12961eae338b9ef2513cdc0
[exporter]
[exporter] *** Image: index.docker.io/library/pivotal-mysql-web:latest@8957afa91f464e2c0adc24968c31613148b9905ff1fb90ec59ff84e165d939ac
===> CACHING
[cacher] Caching layer 'org.cloudfoundry.openjdk:d2df8bc799b09c8375f79bf646747afac3d933bb1f65de71d6c78e7466ff8fe4' with SHA sha256:11439713b023be71211cb83ecd56a1be63e0c0be3e4814a18cc4c71d2264dea5
Successfully built image pivotal-mysql-web
2. Inspect the docker image on your laptop as shown below
papicella@papicella:~/pivotal/PCF/APJ/PPTX/CNCF/buildpacks.io/demos$ docker image inspect pivotal-mysql-web
[
{
"Id": "sha256:8957afa91f464e2c0adc24968c31613148b9905ff1fb90ec59ff84e165d939ac",
"RepoTags": [
"pivotal-mysql-web:latest"
],
"RepoDigests": [],
"Parent": "",
"Comment": "",
"Created": "2019-06-05T05:25:58Z",
"Container": "",
"ContainerConfig": {
...
3. Run the docker image as shown below
papicella@papicella:~/pivotal/PCF/APJ/PPTX/CNCF/buildpacks.io/demos$ docker run --rm -p 8080:8080 pivotal-mysql-web
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.0.RELEASE)
2019-06-05 05:30:43.005 INFO 1 --- [ main] c.p.p.m.PivotalMySqlWebApplication : Starting PivotalMySqlWebApplication on 5d21f8f32ba4 with PID 1 (/workspace/BOOT-INF/classes started by vcap in /workspace)
2019-06-05 05:30:43.009 INFO 1 --- [ main] c.p.p.m.PivotalMySqlWebApplication : No active profile set, falling back to default profiles: default
2019-06-05 05:30:44.662 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-06-05 05:30:44.686 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-06-05 05:30:44.687 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/9.0.12
2019-06-05 05:30:44.698 INFO 1 --- [ main] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/layers/org.cloudfoundry.openjdk/openjdk-jre/lib:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib]
2019-06-05 05:30:44.793 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-06-05 05:30:44.794 INFO 1 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1736 ms
2019-06-05 05:30:45.130 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2019-06-05 05:30:45.131 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webMvcMetricsFilter' to: [/*]
2019-06-05 05:30:45.131 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2019-06-05 05:30:45.131 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'formContentFilter' to: [/*]
2019-06-05 05:30:45.132 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2019-06-05 05:30:45.132 INFO 1 --- [ main] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2019-06-05 05:30:45.133 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpTraceFilter' to: [/*]
2019-06-05 05:30:45.134 INFO 1 --- [ main] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2019-06-05 05:30:45.436 INFO 1 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-06-05 05:30:45.851 INFO 1 --- [ main] .s.s.UserDetailsServiceAutoConfiguration :
Using generated security password: 3823aef6-6f72-4f5f-939d-bbd3d57ec2fa
2019-06-05 05:30:45.931 INFO 1 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: Ant [pattern='/**'], []
2019-06-05 05:30:45.967 INFO 1 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@2e140e59, org.springframework.security.web.context.SecurityContextPersistenceFilter@26ae880a, org.springframework.security.web.header.HeaderWriterFilter@25a73de1, org.springframework.security.web.csrf.CsrfFilter@652ab8d9, org.springframework.security.web.authentication.logout.LogoutFilter@17814b1c, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@54f66455, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter@58399d82, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter@49a71302, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@4c03a37, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@3c017078, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@298d9a05, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@5cd61783, org.springframework.security.web.session.SessionManagementFilter@771db12c, org.springframework.security.web.access.ExceptionTranslationFilter@5f303ecd, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@73ab3aac]
2019-06-05 05:30:46.000 INFO 1 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 9 endpoint(s) beneath base path '/actuator'
2019-06-05 05:30:46.096 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2019-06-05 05:30:46.101 INFO 1 --- [ main] c.p.p.m.PivotalMySqlWebApplication : Started PivotalMySqlWebApplication in 3.654 seconds (JVM running for 4.324)
https://buildpacks.io/
Until cloud platforms such as Heroku and Pivotal Cloud Foundry incorporate the Buildpack v3 Lifecycle, the fastest way to try Cloud Native Buildpacks is via the pack CLI, which integrates with your local Docker daemon. Here is an example below taking Pivotal MySQLWeb application and creating an OCI compliant image from that
Pre Steps:
1. Install pack using this link
https://buildpacks.io/docs/install-pack/
2. Ensure you have Docker CE installed if not use this link
https://hub.docker.com/search/?type=edition&offering=community
Steps:
1. I am using Pivotal MySQLWeb which i have packaged using maven and then taken the JAR and exploded it onto the file system to avoid compilation. You can still just use source code and the Cloud Native Buildpack's will still work but in this example I avoid the maven compilation step by using an exploded JAR file already compiled which is what a Build Service on a cloud platform would do in any case
Let's start by using "pack" to create our image as per below
papicella@papicella:~/pivotal/PCF/APJ/PPTX/CNCF/buildpacks.io/demos$ pack build pivotal-mysql-web --path ./PivotalMySQLWeb
Using default builder image cloudfoundry/cnb:cflinuxfs3
Pulling image index.docker.io/cloudfoundry/cnb:cflinuxfs3
cflinuxfs3: Pulling from cloudfoundry/cnb
18d7ea8d445c: Pull complete
18d0be9dc457: Pull complete
f5407c34df38: Pull complete
35c61e03e6bf: Pull complete
40d144c93ada: Pull complete
4f4fb700ef54: Pull complete
0432ec3bb9f8: Pull complete
3731e128636c: Pull complete
1bab066bbafe: Pull complete
4cc53e89f635: Pull complete
4fd62e90f994: Pull complete
dc9fa77b2cd2: Pull complete
3cd4ed6e9bbf: Pull complete
a525f8221dc8: Pull complete
f01bc40f59c5: Pull complete
1f9842b1696d: Pull complete
3e15eeb884d5: Pull complete
3c0f59c7956f: Pull complete
c3e6214340d9: Pull complete
6955f2c8bfad: Pull complete
5112994886a0: Pull complete
e19195f86112: Pull complete
07fb5cd454f2: Pull complete
Digest: sha256:197439e9ccc699daa6431bd7154c80b3b0ce75b072792a0e93edd6779756f3bc
Status: Downloaded newer image for cloudfoundry/cnb:cflinuxfs3
Selected run image cloudfoundry/cnb-run:cflinuxfs3 from builder
Pulling image cloudfoundry/cnb-run:cflinuxfs3
cflinuxfs3: Pulling from cloudfoundry/cnb-run
0a25bf28c5eb: Pull complete
7216becd0525: Pull complete
Digest: sha256:f9605c5af04b2ba04918879f2bf9d37c55620ae28e73b94e9926cd97bbf8fe96
Status: Downloaded newer image for cloudfoundry/cnb-run:cflinuxfs3
Using build cache volume pack-cache-1f2556cf858e.build
Executing lifecycle version 0.2.1
===> DETECTING
[detector] Trying group 1 out of 4 with 8 buildpacks...
[detector] ======== Results ========
[detector] pass: Cloud Foundry OpenJDK Buildpack
[detector] skip: Cloud Foundry Build System Buildpack
[detector] pass: Cloud Foundry JVM Application Buildpack
[detector] skip: Cloud Foundry Azure Application Insights Buildpack
[detector] skip: Cloud Foundry Debug Buildpack
[detector] skip: Cloud Foundry Google Stackdriver Buildpack
[detector] skip: Cloud Foundry JMX Buildpack
[detector] skip: Cloud Foundry Procfile Buildpack
===> RESTORING
[restorer] cache '/cache': metadata not found, nothing to restore
===> ANALYZING
===> BUILDING
[builder] -----> Cloud Foundry OpenJDK Buildpack 1.0.0-M8
[builder] -----> OpenJDK JRE 11.0.3: Contributing to layer
[builder] Downloading from https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U-jre_x64_linux_hotspot_11.0.3_7.tar.gz
[builder] Verifying checksum
[builder] Expanding to /layers/org.cloudfoundry.openjdk/openjdk-jre
[builder] Writing JAVA_HOME to shared
[builder]
[builder] -----> Cloud Foundry JVM Application Buildpack 1.0.0-M8
[builder] -----> Main-Class Classpath: Contributing to layer
[builder] Writing CLASSPATH to launch
[builder] -----> Process types:
[builder] task: java -cp $CLASSPATH $JAVA_OPTS org.springframework.boot.loader.JarLauncher
[builder] web: java -cp $CLASSPATH $JAVA_OPTS org.springframework.boot.loader.JarLauncher
[builder]
===> EXPORTING
[exporter] Exporting layer 'app' with SHA sha256:b32618ed6b86fb496a4ce33db9df49fdd4ef16c5646b174b5643c8befcb7408a
[exporter] Exporting layer 'config' with SHA sha256:9538e967fa10f23b3415c382a3754ebf4c2645c20b6d76af519236c1181e7639
[exporter] Exporting layer 'launcher' with SHA sha256:04ca7957074763290a9abe6a067ce8c902a2ab51ed6c55102964e3f3294cdebd
[exporter] Exporting layer 'org.cloudfoundry.openjdk:openjdk-jre' with SHA sha256:e540f1464509ac673a25bd2f24c7dd6875f805c0dd35e9af84dd4669e2fd0c93
[exporter] Exporting layer 'org.cloudfoundry.jvmapplication:main-class' with SHA sha256:8537197b3f57d86a59397b89b4fbdd14900a602cc12961eae338b9ef2513cdc0
[exporter]
[exporter] *** Image: index.docker.io/library/pivotal-mysql-web:latest@8957afa91f464e2c0adc24968c31613148b9905ff1fb90ec59ff84e165d939ac
===> CACHING
[cacher] Caching layer 'org.cloudfoundry.openjdk:d2df8bc799b09c8375f79bf646747afac3d933bb1f65de71d6c78e7466ff8fe4' with SHA sha256:11439713b023be71211cb83ecd56a1be63e0c0be3e4814a18cc4c71d2264dea5
Successfully built image pivotal-mysql-web
2. Inspect the docker image on your laptop as shown below
papicella@papicella:~/pivotal/PCF/APJ/PPTX/CNCF/buildpacks.io/demos$ docker image inspect pivotal-mysql-web
[
{
"Id": "sha256:8957afa91f464e2c0adc24968c31613148b9905ff1fb90ec59ff84e165d939ac",
"RepoTags": [
"pivotal-mysql-web:latest"
],
"RepoDigests": [],
"Parent": "",
"Comment": "",
"Created": "2019-06-05T05:25:58Z",
"Container": "",
"ContainerConfig": {
...
3. Run the docker image as shown below
papicella@papicella:~/pivotal/PCF/APJ/PPTX/CNCF/buildpacks.io/demos$ docker run --rm -p 8080:8080 pivotal-mysql-web
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.0.RELEASE)
2019-06-05 05:30:43.005 INFO 1 --- [ main] c.p.p.m.PivotalMySqlWebApplication : Starting PivotalMySqlWebApplication on 5d21f8f32ba4 with PID 1 (/workspace/BOOT-INF/classes started by vcap in /workspace)
2019-06-05 05:30:43.009 INFO 1 --- [ main] c.p.p.m.PivotalMySqlWebApplication : No active profile set, falling back to default profiles: default
2019-06-05 05:30:44.662 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-06-05 05:30:44.686 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-06-05 05:30:44.687 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/9.0.12
2019-06-05 05:30:44.698 INFO 1 --- [ main] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/layers/org.cloudfoundry.openjdk/openjdk-jre/lib:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib]
2019-06-05 05:30:44.793 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-06-05 05:30:44.794 INFO 1 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1736 ms
2019-06-05 05:30:45.130 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2019-06-05 05:30:45.131 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webMvcMetricsFilter' to: [/*]
2019-06-05 05:30:45.131 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2019-06-05 05:30:45.131 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'formContentFilter' to: [/*]
2019-06-05 05:30:45.132 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2019-06-05 05:30:45.132 INFO 1 --- [ main] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2019-06-05 05:30:45.133 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpTraceFilter' to: [/*]
2019-06-05 05:30:45.134 INFO 1 --- [ main] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2019-06-05 05:30:45.436 INFO 1 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-06-05 05:30:45.851 INFO 1 --- [ main] .s.s.UserDetailsServiceAutoConfiguration :
Using generated security password: 3823aef6-6f72-4f5f-939d-bbd3d57ec2fa
2019-06-05 05:30:45.931 INFO 1 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: Ant [pattern='/**'], []
2019-06-05 05:30:45.967 INFO 1 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@2e140e59, org.springframework.security.web.context.SecurityContextPersistenceFilter@26ae880a, org.springframework.security.web.header.HeaderWriterFilter@25a73de1, org.springframework.security.web.csrf.CsrfFilter@652ab8d9, org.springframework.security.web.authentication.logout.LogoutFilter@17814b1c, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@54f66455, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter@58399d82, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter@49a71302, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@4c03a37, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@3c017078, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@298d9a05, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@5cd61783, org.springframework.security.web.session.SessionManagementFilter@771db12c, org.springframework.security.web.access.ExceptionTranslationFilter@5f303ecd, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@73ab3aac]
2019-06-05 05:30:46.000 INFO 1 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 9 endpoint(s) beneath base path '/actuator'
2019-06-05 05:30:46.096 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2019-06-05 05:30:46.101 INFO 1 --- [ main] c.p.p.m.PivotalMySqlWebApplication : Started PivotalMySqlWebApplication in 3.654 seconds (JVM running for 4.324)
4. Browse to localhost:8080 to invoke the application just to be sure it worked
5. Publish the OCI compliant image to your registry. In this example I am using Docker Hub as shown below
papicella@papicella:~/pivotal/PCF/APJ/PPTX/CNCF/buildpacks.io/demos$ pack build pasapples/pivotal-mysql-web:latest --publish --path ./PivotalMySQLWeb --no-pull
Using default builder image cloudfoundry/cnb:cflinuxfs3
Selected run image cloudfoundry/cnb-run:cflinuxfs3 from builder
Using build cache volume pack-cache-a4a78257c7be.build
Executing lifecycle version 0.2.1
===> DETECTING
[detector] Trying group 1 out of 4 with 8 buildpacks...
[detector] ======== Results ========
[detector] pass: Cloud Foundry OpenJDK Buildpack
[detector] skip: Cloud Foundry Build System Buildpack
[detector] pass: Cloud Foundry JVM Application Buildpack
[detector] skip: Cloud Foundry Azure Application Insights Buildpack
[detector] skip: Cloud Foundry Debug Buildpack
[detector] skip: Cloud Foundry Google Stackdriver Buildpack
[detector] skip: Cloud Foundry JMX Buildpack
[detector] skip: Cloud Foundry Procfile Buildpack
===> RESTORING
[restorer] cache '/cache': metadata not found, nothing to restore
===> ANALYZING
===> BUILDING
[builder] -----> Cloud Foundry OpenJDK Buildpack 1.0.0-M8
[builder] -----> OpenJDK JRE 11.0.3: Contributing to layer
[builder] Downloading from https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U-jre_x64_linux_hotspot_11.0.3_7.tar.gz
[builder] Verifying checksum
[builder] Expanding to /layers/org.cloudfoundry.openjdk/openjdk-jre
[builder] Writing JAVA_HOME to shared
[builder]
[builder] -----> Cloud Foundry JVM Application Buildpack 1.0.0-M8
[builder] -----> Main-Class Classpath: Contributing to layer
[builder] Writing CLASSPATH to launch
[builder] -----> Process types:
[builder] task: java -cp $CLASSPATH $JAVA_OPTS org.springframework.boot.loader.JarLauncher
[builder] web: java -cp $CLASSPATH $JAVA_OPTS org.springframework.boot.loader.JarLauncher
[builder]
===> EXPORTING
[exporter] Exporting layer 'app' with SHA sha256:b32618ed6b86fb496a4ce33db9df49fdd4ef16c5646b174b5643c8befcb7408a
[exporter] Exporting layer 'config' with SHA sha256:9538e967fa10f23b3415c382a3754ebf4c2645c20b6d76af519236c1181e7639
[exporter] Exporting layer 'launcher' with SHA sha256:04ca7957074763290a9abe6a067ce8c902a2ab51ed6c55102964e3f3294cdebd
[exporter] Exporting layer 'org.cloudfoundry.openjdk:openjdk-jre' with SHA sha256:e540f1464509ac673a25bd2f24c7dd6875f805c0dd35e9af84dd4669e2fd0c93
[exporter] Exporting layer 'org.cloudfoundry.jvmapplication:main-class' with SHA sha256:8537197b3f57d86a59397b89b4fbdd14900a602cc12961eae338b9ef2513cdc0
[exporter]
[exporter] *** Image: index.docker.io/pasapples/pivotal-mysql-web:latest@sha256:c862eda516289c2daa29580c95b74b4d72eca9caf941a3a6ac2bf2bd886057e5
===> CACHING
[cacher] Caching layer 'org.cloudfoundry.openjdk:d2df8bc799b09c8375f79bf646747afac3d933bb1f65de71d6c78e7466ff8fe4' with SHA sha256:11439713b023be71211cb83ecd56a1be63e0c0be3e4814a18cc4c71d2264dea5
Successfully built image pasapples/pivotal-mysql-web:latest
At this point you have a OCI compliant image sitting in your registry ready to be consumed for your K8's application needs all from just source code or pre compiled source code in this example a Java Application. Let's not forget this support's a polyglot programming model so supports NodeJS, Python and anything that buildpack's supports.
More Information
1. Cloud Native Buildpacks: an Industry-Standard Build Process for Kubernetes and Beyond.
2. buildspacks.io Home Page
Categories: Fusion Middleware
Metrics Driven Blue-green Deployments using Spinnaker’s Cloud Foundry Integration
I recently attended CF Summit in Philadelphia in March 2019 and here is the talk track to that.
Metrics Driven Blue-green Deployments using Spinnaker’s Cloud Foundry Integration - Amith Nambiar & Pas Apicella, Pivotal
https://www.youtube.com/watch?v=9C8m7n_sG38
Metrics Driven Blue-green Deployments using Spinnaker’s Cloud Foundry Integration - Amith Nambiar & Pas Apicella, Pivotal
https://www.youtube.com/watch?v=9C8m7n_sG38
Categories: Fusion Middleware
Any App, Every Cloud, One Platform: Delivering on Pivotal’s Vision
Pivotal Cloud Foundry (PCF) recently turned five-years-old. In celebration, Onsi Fakhouri reflects on how far the platform has come, and provides a look at our plans for the months and years ahead.
The Pivotal Blog post exists here:
https://content.pivotal.io/blog/any-app-every-cloud-one-platform-delivering-on-pivotal-s-vision
The Pivotal Blog post exists here:
https://content.pivotal.io/blog/any-app-every-cloud-one-platform-delivering-on-pivotal-s-vision
Categories: Fusion Middleware
Deploying an Application to Pivotal Cloud Foundry through Spinnaker and then invoking a resize operation
In this post we show a basic deployment to Cloud foundry in fact Pivotal Cloud foundry 2.4 using spinnaker 1.13.0.
Assumptions:
1. Configured a Cloud Foundry provider as shown below
spinnaker@myspinnaker-spinnaker-halyard-0:/workdir$ hal config provider cloudfoundry account add pez208 --user admin --password mypassword --api api.system.run.myenv.io --environment dev --appsManagerURI https://apps.system.run.myenv.io
+ Get current deployment
Success
+ Add the pez208 account
Success
Problems in default.provider.cloudfoundry:
- WARNING To be able to link server groups to CF Metrics a URI is
required: pez208
+ Successfully added account pez208 for provider cloudfoundry.
2. Enable cloud foundry provider
spinnaker@myspinnaker-spinnaker-halyard-0:/workdir$ hal config provider cloudfoundry enable
+ Get current deployment
Success
+ Edit the cloudfoundry provider
Success
+ Successfully enabled cloudfoundry
3. Run "hal deploy apply"
spinnaker@myspinnaker-spinnaker-halyard-0:/workdir$ hal deploy apply
+ Get current deployment
Success
+ Prep deployment
Success
+ Preparation complete... deploying Spinnaker
+ Get current deployment
Success
+ Apply deployment
Success
+ Deploy spin-clouddriver
Success
+ Deploy spin-front50
Success
+ Deploy spin-orca
Success
+ Deploy spin-deck
Success
+ Deploy spin-echo
Success
+ Deploy spin-gate
Success
+ Deploy spin-igor
Success
+ Deploy spin-rosco
Success
+ Run `hal deploy connect` to connect to Spinnaker.
IN this demo I can simply going to deploy my artifact sitting within my GitHub repo using a HTTP endpoiunt so for that will need to enable HTTP artifact support in Spinnaker as shown below
$ hal config features edit --artifacts true
$ hal config artifact http enable
$ hal config artifact http account add apples-http
$ hal deploy apply
Steps:
1. Lets create a new application called "pastest" as shown below. Be sure to select "CloudFoundry" provider.
2. Click "Create"
3. Click on "Create Server group"
4. Fill in the fields as shown below. In this example I am using the following
5. Click "Create"
6. Verify your application is going through the deploy phase as shown in the dialog
7. Oncer complete we can see our deployed application in Pivotal Cloud Foundry Applications Manager as shown below.
8. Now if we return to the Spinnaker UI we will see various views of what we just deployed as follows
Server Group Main Page
Load Balancer Page
Instance Page
9. Now let's actually scale our application to 2 instances rather than just a single instance. To do that lets click the "Resize Option" in the "Server Group Page" as shown below
10. In the dialog which appears set "Resize to" to "2"
11. Click "Submit"
12. Return to Pivotal Cloud Foundry Applications Manager and verify we now have 2 instances of our application as shown below
13. This will also be reflected on Spinnaker UI as well
More Information
Cloud Foundry - Cloud Provider
https://www.spinnaker.io/reference/providers/cf/
Assumptions:
1. Configured a Cloud Foundry provider as shown below
spinnaker@myspinnaker-spinnaker-halyard-0:/workdir$ hal config provider cloudfoundry account add pez208 --user admin --password mypassword --api api.system.run.myenv.io --environment dev --appsManagerURI https://apps.system.run.myenv.io
+ Get current deployment
Success
+ Add the pez208 account
Success
Problems in default.provider.cloudfoundry:
- WARNING To be able to link server groups to CF Metrics a URI is
required: pez208
+ Successfully added account pez208 for provider cloudfoundry.
2. Enable cloud foundry provider
spinnaker@myspinnaker-spinnaker-halyard-0:/workdir$ hal config provider cloudfoundry enable
+ Get current deployment
Success
+ Edit the cloudfoundry provider
Success
+ Successfully enabled cloudfoundry
3. Run "hal deploy apply"
spinnaker@myspinnaker-spinnaker-halyard-0:/workdir$ hal deploy apply
+ Get current deployment
Success
+ Prep deployment
Success
+ Preparation complete... deploying Spinnaker
+ Get current deployment
Success
+ Apply deployment
Success
+ Deploy spin-clouddriver
Success
+ Deploy spin-front50
Success
+ Deploy spin-orca
Success
+ Deploy spin-deck
Success
+ Deploy spin-echo
Success
+ Deploy spin-gate
Success
+ Deploy spin-igor
Success
+ Deploy spin-rosco
Success
+ Run `hal deploy connect` to connect to Spinnaker.
IN this demo I can simply going to deploy my artifact sitting within my GitHub repo using a HTTP endpoiunt so for that will need to enable HTTP artifact support in Spinnaker as shown below
$ hal config features edit --artifacts true
$ hal config artifact http enable
$ hal config artifact http account add apples-http
$ hal deploy apply
Steps:
1. Lets create a new application called "pastest" as shown below. Be sure to select "CloudFoundry" provider.
2. Click "Create"
3. Click on "Create Server group"
4. Fill in the fields as shown below. In this example I am using the following
- Account "pez208" which was the cloud foundry provider name we used above
- Region is basically the CF space we will deploy into
- HTTP artifact which I enabled called "apples-http".
- Fully qualified path to my JAR file I wish to deploy
- Form based manifest settings to define my application deployment settings
5. Click "Create"
6. Verify your application is going through the deploy phase as shown in the dialog
7. Oncer complete we can see our deployed application in Pivotal Cloud Foundry Applications Manager as shown below.
8. Now if we return to the Spinnaker UI we will see various views of what we just deployed as follows
Server Group Main Page
Load Balancer Page
Instance Page
9. Now let's actually scale our application to 2 instances rather than just a single instance. To do that lets click the "Resize Option" in the "Server Group Page" as shown below
10. In the dialog which appears set "Resize to" to "2"
11. Click "Submit"
12. Return to Pivotal Cloud Foundry Applications Manager and verify we now have 2 instances of our application as shown below
13. This will also be reflected on Spinnaker UI as well
More Information
Cloud Foundry - Cloud Provider
https://www.spinnaker.io/reference/providers/cf/
Categories: Fusion Middleware
Two nice Pivotal Container Service (PKS) CLI commands I use very often
Having always created multiple PKS clusters at times I forget the configuration of my K8S clusters and this command comes in very handy
First lets list those clusters we have created with PKS
papicella@papicella:~$ pks clusters
Name Plan Name UUID Status Action
lemons small 5c19c39e-88ae-4e06-a1cf-050b517f1b9c succeeded CREATE
banana small 7c3ab1b3-a25c-498e-8179-9a14336004ff succeeded CREATE
Now lets see how many master nodes and how many worker nodes actually exist in my cluster using "pks cluster {name} --json"
papicella@papicella:~$ pks cluster banana --json
{
"name": "banana",
"plan_name": "small",
"last_action": "CREATE",
"last_action_state": "succeeded",
"last_action_description": "Instance provisioning completed",
"uuid": "7c3ab1b3-a25c-498e-8179-9a14336004ff",
"kubernetes_master_ips": [
"10.0.0.1"
],
"parameters": {
"kubernetes_master_host": "banana.yyyy.hhh.pivotal.io",
"kubernetes_master_port": 8443,
"kubernetes_worker_instances": 3
}
}
One final PKS CLI command I use often when creating my clusters is the --wait option so I know when it's done creating the cluster rather then continually checking using "pks cluster {name}"
papicella@papicella:~$ pks create-cluster cluster1 -e cluster1.run.yyyy.hhh.pivotal.io -p small -n 4 --wait
More Information
https://docs.pivotal.io/runtimes/pks/1-3/cli/index.html
First lets list those clusters we have created with PKS
papicella@papicella:~$ pks clusters
Name Plan Name UUID Status Action
lemons small 5c19c39e-88ae-4e06-a1cf-050b517f1b9c succeeded CREATE
banana small 7c3ab1b3-a25c-498e-8179-9a14336004ff succeeded CREATE
Now lets see how many master nodes and how many worker nodes actually exist in my cluster using "pks cluster {name} --json"
papicella@papicella:~$ pks cluster banana --json
{
"name": "banana",
"plan_name": "small",
"last_action": "CREATE",
"last_action_state": "succeeded",
"last_action_description": "Instance provisioning completed",
"uuid": "7c3ab1b3-a25c-498e-8179-9a14336004ff",
"kubernetes_master_ips": [
"10.0.0.1"
],
"parameters": {
"kubernetes_master_host": "banana.yyyy.hhh.pivotal.io",
"kubernetes_master_port": 8443,
"kubernetes_worker_instances": 3
}
}
One final PKS CLI command I use often when creating my clusters is the --wait option so I know when it's done creating the cluster rather then continually checking using "pks cluster {name}"
papicella@papicella:~$ pks create-cluster cluster1 -e cluster1.run.yyyy.hhh.pivotal.io -p small -n 4 --wait
More Information
https://docs.pivotal.io/runtimes/pks/1-3/cli/index.html
Categories: Fusion Middleware
Spring Initializr new look and feel
Categories: Fusion Middleware
Integrating Cloud Foundry with Spinnaker
I previously blogged about "Installing Spinnaker on Pivotal Container Service (PKS) with NSX-T running on vSphere" and then how to invoke UI using a "kubectl port-forward".
http://theblasfrompas.blogspot.com/2019/02/installing-spinnaker-on-pivotal.html
http://theblasfrompas.blogspot.com/2019/02/exposing-spinnaker-ui-endpoint-from.html
Steps
1. Exec into hal pod using a command as follows:
$ kubectl exec --namespace default -it myspinnaker-spinnaker-halyard-0 bash
Note: You can get the POD name as follows
papicella@papicella:~$ kubectl get pods | grep halyard
myspinnaker-spinnaker-halyard-0 1/1 Running 0 6d
2. Create a file settings-local.js in the directory ~/.hal/default/profiles/
window.spinnakerSettings.providers.cloudfoundry = {
defaults: {account: 'my-cloudfoundry-account'}
};
3. Create a file clouddriver-local.yml with contents as follows. You can add multiple accounts but in this example I am just adding one
cloudfoundry:
enabled: true
accounts:
- name: PWS
user: papicella-pas@pivotal.io
password: yyyyyyy
api: api.run.pivotal.io
4. If you are working with an existing installation of Spinnaker, apply your changes:
spinnaker@myspinnaker-spinnaker-halyard-0:~/.hal/default/profiles$ hal deploy apply
+ Get current deployment
Success
+ Prep deployment
Success
Problems in halconfig:
- WARNING There is a newer version of Halyard available (1.15.0),
please update when possible
? Run 'sudo apt-get update && sudo apt-get install
spinnaker-halyard -y' to upgrade
+ Preparation complete... deploying Spinnaker
+ Get current deployment
Success
+ Apply deployment
Success
+ Run `hal deploy connect` to connect to Spinnaker.
5. Once this is done in the UI you will see any applications in your Organisations appear in this example it's a single application called "Spring" as shown below
6. In the example below when "Creating an Application" we can select the ORGS/Spaces we wish to use as shown below
More Information
Cloud Foundry Integration
https://www.spinnaker.io/setup/install/providers/cf/
Cloud Foundry Resource Mapping
https://www.spinnaker.io/reference/providers/cf/
http://theblasfrompas.blogspot.com/2019/02/installing-spinnaker-on-pivotal.html
http://theblasfrompas.blogspot.com/2019/02/exposing-spinnaker-ui-endpoint-from.html
Steps
1. Exec into hal pod using a command as follows:
$ kubectl exec --namespace default -it myspinnaker-spinnaker-halyard-0 bash
Note: You can get the POD name as follows
papicella@papicella:~$ kubectl get pods | grep halyard
myspinnaker-spinnaker-halyard-0 1/1 Running 0 6d
2. Create a file settings-local.js in the directory ~/.hal/default/profiles/
window.spinnakerSettings.providers.cloudfoundry = {
defaults: {account: 'my-cloudfoundry-account'}
};
3. Create a file clouddriver-local.yml with contents as follows. You can add multiple accounts but in this example I am just adding one
cloudfoundry:
enabled: true
accounts:
- name: PWS
user: papicella-pas@pivotal.io
password: yyyyyyy
api: api.run.pivotal.io
4. If you are working with an existing installation of Spinnaker, apply your changes:
spinnaker@myspinnaker-spinnaker-halyard-0:~/.hal/default/profiles$ hal deploy apply
+ Get current deployment
Success
+ Prep deployment
Success
Problems in halconfig:
- WARNING There is a newer version of Halyard available (1.15.0),
please update when possible
? Run 'sudo apt-get update && sudo apt-get install
spinnaker-halyard -y' to upgrade
+ Preparation complete... deploying Spinnaker
+ Get current deployment
Success
+ Apply deployment
Success
+ Run `hal deploy connect` to connect to Spinnaker.
5. Once this is done in the UI you will see any applications in your Organisations appear in this example it's a single application called "Spring" as shown below
6. In the example below when "Creating an Application" we can select the ORGS/Spaces we wish to use as shown below
More Information
Cloud Foundry Integration
https://www.spinnaker.io/setup/install/providers/cf/
Cloud Foundry Resource Mapping
https://www.spinnaker.io/reference/providers/cf/
Categories: Fusion Middleware
Exposing Spinnaker UI endpoint from a helm based spinnaker install on PKS with NSX-T
I previously blogged about "Installing Spinnaker on Pivotal Container Service (PKS) with NSX-T running on vSphere" and then quickly invoking the UI using a "kubectl port-forward" as per this post.
http://theblasfrompas.blogspot.com/2019/02/installing-spinnaker-on-pivotal.html
That will work BUT but it won't get you too far so his what you would need to do so the UI works completely using the spin-gate API endpoint.
Steps (Once Spinnaker is Running)
1. Expose spin-deck and spin-gate to create external LB IP's. This is where NSX-T with PKS on prem is extremely useful as NSX-T has LB capability for your K8's cluster services you create making it as easier then using public cloud LB with Kubernetes.
$ kubectl expose service -n default spin-deck --type LoadBalancer --port 9000 --target-port 9000 --name spin-deck-public
service/spin-deck-public exposed
$ kubectl expose service -n default spin-gate --type LoadBalancer --port 8084 --target-port 8084 --name spin-gate-public
service/spin-gate-public exposed
2. That will create us two external IP's as shown below
$ kubectl get svc
...
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
spin-deck-public LoadBalancer 10.100.200.200 10.195.44.1,100.64.128.15 9000:30131/TCP ..
spin-gate-public LoadBalancer 10.100.200.5 10.195.44.2,100.64.128.15 8084:30312/TCP ..
...
3. Exec into hal pod using a command as follows
$ kubectl exec --namespace default -it myspinnaker-spinnaker-halyard-0 bash
http://theblasfrompas.blogspot.com/2019/02/installing-spinnaker-on-pivotal.html
That will work BUT but it won't get you too far so his what you would need to do so the UI works completely using the spin-gate API endpoint.
Steps (Once Spinnaker is Running)
1. Expose spin-deck and spin-gate to create external LB IP's. This is where NSX-T with PKS on prem is extremely useful as NSX-T has LB capability for your K8's cluster services you create making it as easier then using public cloud LB with Kubernetes.
$ kubectl expose service -n default spin-deck --type LoadBalancer --port 9000 --target-port 9000 --name spin-deck-public
service/spin-deck-public exposed
$ kubectl expose service -n default spin-gate --type LoadBalancer --port 8084 --target-port 8084 --name spin-gate-public
service/spin-gate-public exposed
2. That will create us two external IP's as shown below
$ kubectl get svc
...
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
spin-deck-public LoadBalancer 10.100.200.200 10.195.44.1,100.64.128.15 9000:30131/TCP ..
spin-gate-public LoadBalancer 10.100.200.5 10.195.44.2,100.64.128.15 8084:30312/TCP ..
...
3. Exec into hal pod using a command as follows
$ kubectl exec --namespace default -it myspinnaker-spinnaker-halyard-0 bash
4. Run these commands in order on the hal pod. Make sure you use the right IP address as per the output at #2 above. UI = spin-deck-public where API = spin-gate-public
$ hal config security ui edit --override-base-url http://10.195.44.1:9000
$ hal config security api edit --override-base-url http://10.195.44.2:8084
$ hal deploy apply
5. Port forward spin-gate on your localhost. Shouldn't really need to do this BUT for some reason it was required I suspect at some point this won't be required.
$ export GATE_POD=$(kubectl get pods --namespace default -l "cluster=spin-gate" -o jsonpath="{.items[0].metadata.name}")
$ echo $GATE_POD
$ kubectl port-forward --namespace default $GATE_POD 8084
spin-gate-85cc7465bd-v2q2l
Forwarding from 127.0.0.1:8084 -> 8084
Forwarding from [::1]:8084 -> 8084
6. Access UI using IP of spin-deck-public
If it worked you should see screen shots as follows showing that we can access the tabs and "Create Application" without errors accessing the gate API endpoint
Categories: Fusion Middleware
Spring Cloud GCP and authentication from your Spring Boot Application
When using Spring Cloud GCP you will need to authenticate at some point in order to use the GCP services. In this example below using a GCP Cloud SQL instance you really only need to do 3 things to access it externally from your Spring Boot application as follows.
1. Enable the Google Cloud SQL API which is detailed here
https://cloud.google.com/sql/docs/mysql/admin-api/
2. Ensure that your GCP SDK can login to your Google Cloud SQL. This command will take you to a web page asking which google account you want to use
$ gcloud auth application-default login
3. Finally some application properties in your Spring Boot application detailing the Google Cloud SQL instance name and database name as shown below.
spring.cloud.gcp.sql.instance-connection-name=fe-papicella:australia-southeast1:apples-db
spring.cloud.gcp.sql.database-name=employees
Now when you do that and your application starts up you will see a log message as follows below clearly warning you this this method of authentication can have implications at some point.
2019-02-07 09:10:26.700 WARN 2477 --- [ main] c.g.a.oauth2.DefaultCredentialsProvider : Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/.
Clearly that's something we have to resolve. To do that we simply can add another Spring Boot application property pointing to a service account JSON file for us to authenticate against to remove the warning.
spring.cloud.gcp.credentials.location=file:/Users/papicella/piv-projects/GCP/fe-papicella-8077fe1126b2.json
Note: You can also use an ENV variable as follows
export GOOGLE_APPLICATION_CREDENTIALS="[PATH]"
You can get a JSON key generated from the GCP console "IAM and Admin -> Service Accounts" page
For more information on authentication visit this link https://cloud.google.com/docs/authentication/getting-started
1. Enable the Google Cloud SQL API which is detailed here
https://cloud.google.com/sql/docs/mysql/admin-api/
2. Ensure that your GCP SDK can login to your Google Cloud SQL. This command will take you to a web page asking which google account you want to use
$ gcloud auth application-default login
3. Finally some application properties in your Spring Boot application detailing the Google Cloud SQL instance name and database name as shown below.
spring.cloud.gcp.sql.instance-connection-name=fe-papicella:australia-southeast1:apples-db
spring.cloud.gcp.sql.database-name=employees
Now when you do that and your application starts up you will see a log message as follows below clearly warning you this this method of authentication can have implications at some point.
2019-02-07 09:10:26.700 WARN 2477 --- [ main] c.g.a.oauth2.DefaultCredentialsProvider : Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/.
Clearly that's something we have to resolve. To do that we simply can add another Spring Boot application property pointing to a service account JSON file for us to authenticate against to remove the warning.
spring.cloud.gcp.credentials.location=file:/Users/papicella/piv-projects/GCP/fe-papicella-8077fe1126b2.json
Note: You can also use an ENV variable as follows
export GOOGLE_APPLICATION_CREDENTIALS="[PATH]"
You can get a JSON key generated from the GCP console "IAM and Admin -> Service Accounts" page
For more information on authentication visit this link https://cloud.google.com/docs/authentication/getting-started
Categories: Fusion Middleware
Installing Spinnaker on Pivotal Container Service (PKS) with NSX-T running on vSphere
I decided to install spinnaker on my vSphere PKS installation into one of my clusters. Here is how I did this step by step
1. You will need PKS installed which I have on vSphere with PKS 1.2 using NSX-T. Here is a screen shot of that showing Ops Manager UI
Make sure your PKS Plans have these check boxes enabled, without these checked spinnaker will not install using the HELM chart we will be using below
2. In my setup I created a DataStore which will be used by my K8's cluster, this is optional you can setup PVC however you see fit.
3. Now it's assumed you have a K8s cluster which I have as shown below. I used the PKS CLI to create a small cluster of 1 master node and 3 worker nodes
$ pks cluster lemons
Name: lemons
Plan Name: small
UUID: 19318553-472d-4bb5-9783-425ce5626149
Last Action: CREATE
Last Action State: succeeded
Last Action Description: Instance provisioning completed
Kubernetes Master Host: lemons.haas-65.pez.pivotal.io
Kubernetes Master Port: 8443
Worker Nodes: 3
Kubernetes Master IP(s): 10.y.y.y
Network Profile Name:
4. Create a Storage Class as follows, notice how we reference our vSphere Data Store named "k8s" as per step 2
$ kubectl create -f storage-class-vsphere.yaml
Note: storage-class-vsphere.yaml defined as follows
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: fast
provisioner: kubernetes.io/vsphere-volume
parameters:
datastore: k8s
diskformat: thin
fstype: ext3
5. Set this Storage Class as the default
$ kubectl patch storageclass fast -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
Verify
papicella@papicella:~$ kubectl get storageclass
NAME PROVISIONER AGE
fast (default) kubernetes.io/vsphere-volume 14h
6. Install helm as shown below
$ kubectl create -f rbac-config.yaml
$ helm init --service-account tiller
$ kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default
$ sleep 10
$ helm ls
Note: rbac-config.yaml defined as follows
apiVersion: v1
kind: ServiceAccount
metadata:
name: tiller
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: tiller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: tiller
namespace: kube-system
7. Install spinnaker into your K8's cluster as follows
$ helm install --name myspinnaker stable/spinnaker --timeout 6000 --debug
If everything worked
papicella@papicella:~$ kubectl get pods
NAME READY STATUS RESTARTS AGE
myspinnaker-install-using-hal-gbd96 0/1 Completed 0 14m
myspinnaker-minio-5d4c999f8b-ttm7f 1/1 Running 0 14m
myspinnaker-redis-master-0 1/1 Running 0 14m
myspinnaker-spinnaker-halyard-0 1/1 Running 0 14m
spin-clouddriver-7b8cd6f964-ksksl 1/1 Running 0 12m
spin-deck-749c84fd77-j2t4h 1/1 Running 0 12m
spin-echo-5b9fd6f9fd-k62kd 1/1 Running 0 12m
spin-front50-6bfffdbbf8-v4cr4 1/1 Running 1 12m
spin-gate-6c4959fc85-lj52h 1/1 Running 0 12m
spin-igor-5f6756d8d7-zrbkw 1/1 Running 0 12m
spin-orca-5dcb7d79f7-v7cds 1/1 Running 0 12m
spin-rosco-7cb8bd4849-c44wg 1/1 Running 0 12m
8. At the end of the HELM command once complete you will see output as follows
1. You will need to create 2 port forwarding tunnels in order to access the Spinnaker UI:
export DECK_POD=$(kubectl get pods --namespace default -l "cluster=spin-deck" -o jsonpath="{.items[0].metadata.name}")
kubectl port-forward --namespace default $DECK_POD 9000
2. Visit the Spinnaker UI by opening your browser to: http://127.0.0.1:9000
To customize your Spinnaker installation. Create a shell in your Halyard pod:
kubectl exec --namespace default -it myspinnaker-spinnaker-halyard-0 bash
For more info on using Halyard to customize your installation, visit:
https://www.spinnaker.io/reference/halyard/
For more info on the Kubernetes integration for Spinnaker, visit:
https://www.spinnaker.io/reference/providers/kubernetes-v2/
9. Go ahead and run these commands to connect using your localhost to the spinnaker UI
$ export DECK_POD=$(kubectl get pods --namespace default -l "cluster=spin-deck" -o jsonpath="{.items[0].metadata.name}")
$ kubectl port-forward --namespace default $DECK_POD 9000
Forwarding from 127.0.0.1:9000 -> 9000
Forwarding from [::1]:9000 -> 9000
10. Browse to http://127.0.0.1:9000
More Information
Spinnaker
https://www.spinnaker.io/
Pivotal Container Service
https://pivotal.io/platform/pivotal-container-service
1. You will need PKS installed which I have on vSphere with PKS 1.2 using NSX-T. Here is a screen shot of that showing Ops Manager UI
Make sure your PKS Plans have these check boxes enabled, without these checked spinnaker will not install using the HELM chart we will be using below
2. In my setup I created a DataStore which will be used by my K8's cluster, this is optional you can setup PVC however you see fit.
3. Now it's assumed you have a K8s cluster which I have as shown below. I used the PKS CLI to create a small cluster of 1 master node and 3 worker nodes
$ pks cluster lemons
Name: lemons
Plan Name: small
UUID: 19318553-472d-4bb5-9783-425ce5626149
Last Action: CREATE
Last Action State: succeeded
Last Action Description: Instance provisioning completed
Kubernetes Master Host: lemons.haas-65.pez.pivotal.io
Kubernetes Master Port: 8443
Worker Nodes: 3
Kubernetes Master IP(s): 10.y.y.y
Network Profile Name:
4. Create a Storage Class as follows, notice how we reference our vSphere Data Store named "k8s" as per step 2
$ kubectl create -f storage-class-vsphere.yaml
Note: storage-class-vsphere.yaml defined as follows
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: fast
provisioner: kubernetes.io/vsphere-volume
parameters:
datastore: k8s
diskformat: thin
fstype: ext3
5. Set this Storage Class as the default
$ kubectl patch storageclass fast -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
Verify
papicella@papicella:~$ kubectl get storageclass
NAME PROVISIONER AGE
fast (default) kubernetes.io/vsphere-volume 14h
6. Install helm as shown below
$ kubectl create -f rbac-config.yaml
$ helm init --service-account tiller
$ kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default
$ sleep 10
$ helm ls
Note: rbac-config.yaml defined as follows
apiVersion: v1
kind: ServiceAccount
metadata:
name: tiller
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: tiller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: tiller
namespace: kube-system
7. Install spinnaker into your K8's cluster as follows
$ helm install --name myspinnaker stable/spinnaker --timeout 6000 --debug
If everything worked
papicella@papicella:~$ kubectl get pods
NAME READY STATUS RESTARTS AGE
myspinnaker-install-using-hal-gbd96 0/1 Completed 0 14m
myspinnaker-minio-5d4c999f8b-ttm7f 1/1 Running 0 14m
myspinnaker-redis-master-0 1/1 Running 0 14m
myspinnaker-spinnaker-halyard-0 1/1 Running 0 14m
spin-clouddriver-7b8cd6f964-ksksl 1/1 Running 0 12m
spin-deck-749c84fd77-j2t4h 1/1 Running 0 12m
spin-echo-5b9fd6f9fd-k62kd 1/1 Running 0 12m
spin-front50-6bfffdbbf8-v4cr4 1/1 Running 1 12m
spin-gate-6c4959fc85-lj52h 1/1 Running 0 12m
spin-igor-5f6756d8d7-zrbkw 1/1 Running 0 12m
spin-orca-5dcb7d79f7-v7cds 1/1 Running 0 12m
spin-rosco-7cb8bd4849-c44wg 1/1 Running 0 12m
8. At the end of the HELM command once complete you will see output as follows
1. You will need to create 2 port forwarding tunnels in order to access the Spinnaker UI:
export DECK_POD=$(kubectl get pods --namespace default -l "cluster=spin-deck" -o jsonpath="{.items[0].metadata.name}")
kubectl port-forward --namespace default $DECK_POD 9000
2. Visit the Spinnaker UI by opening your browser to: http://127.0.0.1:9000
To customize your Spinnaker installation. Create a shell in your Halyard pod:
kubectl exec --namespace default -it myspinnaker-spinnaker-halyard-0 bash
For more info on using Halyard to customize your installation, visit:
https://www.spinnaker.io/reference/halyard/
For more info on the Kubernetes integration for Spinnaker, visit:
https://www.spinnaker.io/reference/providers/kubernetes-v2/
9. Go ahead and run these commands to connect using your localhost to the spinnaker UI
$ export DECK_POD=$(kubectl get pods --namespace default -l "cluster=spin-deck" -o jsonpath="{.items[0].metadata.name}")
$ kubectl port-forward --namespace default $DECK_POD 9000
Forwarding from 127.0.0.1:9000 -> 9000
Forwarding from [::1]:9000 -> 9000
10. Browse to http://127.0.0.1:9000
More Information
Spinnaker
https://www.spinnaker.io/
Pivotal Container Service
https://pivotal.io/platform/pivotal-container-service
Categories: Fusion Middleware
Testing out the new PFS (Pivotal Function Service) alpha release on minikube
I quickly installed PFS on minikube as per the instructions below so I could write my own function service. Below shows that function service and how I invoked using the PFS CLI and Postman
1. Install PFS using this url for minikube. Refer to these instructions to install PFS on minikube
https://docs.pivotal.io/pfs/install-on-minikube.html
2. Once installed verify PFS has been installed using some commands as follows
$ watch -n 1 kubectl get pod --all-namespaces
Output:
Various namespaces are created as shown below:
$ kubectl get namespaces
NAME STATUS AGE
default Active 19h
istio-system Active 18h
knative-build Active 18h
knative-eventing Active 18h
knative-serving Active 18h
kube-public Active 19h
kube-system Active 19h
Ensure PFS is installed as shown below:
$ pfs version
Version
pfs cli: 0.1.0 (e5de84d12d10a060aeb595310decbe7409467c99)
3. Now we are going to deploy this employee function which exists on GitHub as follows
https://github.com/papicella/emp-function-service
The Function code is as follows:
https://docs.pivotal.io/pfs/using-java-functions.html
5. Let's create a function called "emp-function" as shown below
$ pfs function create emp-function --git-repo https://github.com/papicella/emp-function-service --image $REGISTRY/$REGISTRY_USER/emp-function -w -v
Output: (Just showing the last few lines here)
papicella@papicella:~/pivotal/software/minikube$ pfs function create emp-function --git-repo https://github.com/papicella/emp-function-service --image $REGISTRY/$REGISTRY_USER/emp-function -w -v
Waiting for LatestCreatedRevisionName
Waiting on function creation: checkService failed to obtain service status for observedGeneration 1
LatestCreatedRevisionName available: emp-function-00001
...
default/emp-function-00001-gpn7p[build-step-build]: [INFO] BUILD SUCCESS
default/emp-function-00001-gpn7p[build-step-build]: [INFO] ------------------------------------------------------------------------
default/emp-function-00001-gpn7p[build-step-build]: [INFO] Total time: 12.407 s
default/emp-function-00001-gpn7p[build-step-build]: [INFO] Finished at: 2019-01-22T00:12:39Z
default/emp-function-00001-gpn7p[build-step-build]: [INFO] ------------------------------------------------------------------------
default/emp-function-00001-gpn7p[build-step-build]: Removing source code
default/emp-function-00001-gpn7p[build-step-build]:
default/emp-function-00001-gpn7p[build-step-build]: -----> riff Buildpack 0.1.0
default/emp-function-00001-gpn7p[build-step-build]: -----> riff Java Invoker 0.1.3: Contributing to launch
default/emp-function-00001-gpn7p[build-step-build]: Reusing cached download from buildpack
default/emp-function-00001-gpn7p[build-step-build]: Copying to /workspace/io.projectriff.riff/riff-invoker-java/java-function-invoker-0.1.3-exec.jar
default/emp-function-00001-gpn7p[build-step-build]: -----> Process types:
default/emp-function-00001-gpn7p[build-step-build]: web: java -jar /workspace/io.projectriff.riff/riff-invoker-java/java-function-invoker-0.1.3-exec.jar $JAVA_OPTS --function.uri='file:///workspace/app'
default/emp-function-00001-gpn7p[build-step-build]: function: java -jar /workspace/io.projectriff.riff/riff-invoker-java/java-function-invoker-0.1.3-exec.jar $JAVA_OPTS --function.uri='file:///workspace/app'
default/emp-function-00001-gpn7p[build-step-build]:
...
default/emp-function-00001-deployment-66fbd6bf4-bbqpq[user-container]: Hibernate: insert into employee (id, name) values (null, ?)
default/emp-function-00001-deployment-66fbd6bf4-bbqpq[user-container]: 2019-01-22 00:13:53.617 INFO 1 --- [ Thread-4] c.e.empfunctionservice.LoadDatabase : Preloading Employee(id=1, name=pas)
default/emp-function-00001-deployment-66fbd6bf4-bbqpq[user-container]: Hibernate: insert into employee (id, name) values (null, ?)
default/emp-function-00001-deployment-66fbd6bf4-bbqpq[user-container]: 2019-01-22 00:13:53.623 INFO 1 --- [ Thread-4] c.e.empfunctionservice.LoadDatabase : Preloading Employee(id=2, name=lucia)
default/emp-function-00001-deployment-66fbd6bf4-bbqpq[user-container]: Hibernate: insert into employee (id, name) values (null, ?)
default/emp-function-00001-deployment-66fbd6bf4-bbqpq[user-container]: 2019-01-22 00:13:53.628 INFO 1 --- [ Thread-4] c.e.empfunctionservice.LoadDatabase : Preloading Employee(id=3, name=lucas)
default/emp-function-00001-deployment-66fbd6bf4-bbqpq[user-container]: Hibernate: insert into employee (id, name) values (null, ?)
default/emp-function-00001-deployment-66fbd6bf4-bbqpq[user-container]: 2019-01-22 00:13:53.632 INFO 1 --- [ Thread-4] c.e.empfunctionservice.LoadDatabase : Preloading Employee(id=4, name=siena)
default/emp-function-00001-deployment-66fbd6bf4-bbqpq[user-container]: 2019-01-22 00:13:53.704 INFO 1 --- [ Thread-2] o.s.c.f.d.FunctionCreatorConfiguration : Located bean: findEmployee of type class com.example.empfunctionservice.EmpFunctionServiceApplication$$Lambda$791/373359604
pfs function create completed successfully
6. Let's invoke our function as shown below by returning each Employee record using it's ID.
$ pfs service invoke emp-function --text -- -w '\n' -d '1'
curl http://192.168.64.3:32380/ -H 'Host: emp-function.default.example.com' -H 'Content-Type: text/plain' -w '\n' -d 1
Employee(id=1, name=pas)
$ pfs service invoke emp-function --text -- -w '\n' -d '2'
curl http://192.168.64.3:32380/ -H 'Host: emp-function.default.example.com' -H 'Content-Type: text/plain' -w '\n' -d 2
Employee(id=2, name=lucia)
The "pfs service invoke" will show you what an external command will look like to invoke the function service. The IP address here is just the same IP address returned by "minikube ip" as shown below.
$ minikube ip
192.168.64.3
7. Let's view our services using "pfs" CLI
$ pfs service list
NAME STATUS
emp-function Running
hello Running
pfs service list completed successfully
8. Invoking from Postman, ensuring we issue a POST request and pass the correct headers as shown below
More Information
https://docs.pivotal.io/pfs/index.html
1. Install PFS using this url for minikube. Refer to these instructions to install PFS on minikube
https://docs.pivotal.io/pfs/install-on-minikube.html
2. Once installed verify PFS has been installed using some commands as follows
$ watch -n 1 kubectl get pod --all-namespaces
Output:
Various namespaces are created as shown below:
$ kubectl get namespaces
NAME STATUS AGE
default Active 19h
istio-system Active 18h
knative-build Active 18h
knative-eventing Active 18h
knative-serving Active 18h
kube-public Active 19h
kube-system Active 19h
Ensure PFS is installed as shown below:
$ pfs version
Version
pfs cli: 0.1.0 (e5de84d12d10a060aeb595310decbe7409467c99)
3. Now we are going to deploy this employee function which exists on GitHub as follows
https://github.com/papicella/emp-function-service
The Function code is as follows:
package com.example.empfunctionservice;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import java.util.function.Function;
@Slf4j
@SpringBootApplication
public class EmpFunctionServiceApplication {
private static EmployeeService employeeService;
public EmpFunctionServiceApplication(EmployeeService employeeService) {
this.employeeService = employeeService;
}
@Bean
public Function<String, String> findEmployee() {
return id -> {
String response = employeeService.getEmployee(id);
return response;
};
}
public static void main(String[] args) {
SpringApplication.run(EmpFunctionServiceApplication.class, args);
}
}
4. We are going to deploy a Spring Boot Function as per the REPO above. More information on Java Functions for PFS can be found here
https://docs.pivotal.io/pfs/using-java-functions.html
5. Let's create a function called "emp-function" as shown below
$ pfs function create emp-function --git-repo https://github.com/papicella/emp-function-service --image $REGISTRY/$REGISTRY_USER/emp-function -w -v
Output: (Just showing the last few lines here)
papicella@papicella:~/pivotal/software/minikube$ pfs function create emp-function --git-repo https://github.com/papicella/emp-function-service --image $REGISTRY/$REGISTRY_USER/emp-function -w -v
Waiting for LatestCreatedRevisionName
Waiting on function creation: checkService failed to obtain service status for observedGeneration 1
LatestCreatedRevisionName available: emp-function-00001
...
default/emp-function-00001-gpn7p[build-step-build]: [INFO] BUILD SUCCESS
default/emp-function-00001-gpn7p[build-step-build]: [INFO] ------------------------------------------------------------------------
default/emp-function-00001-gpn7p[build-step-build]: [INFO] Total time: 12.407 s
default/emp-function-00001-gpn7p[build-step-build]: [INFO] Finished at: 2019-01-22T00:12:39Z
default/emp-function-00001-gpn7p[build-step-build]: [INFO] ------------------------------------------------------------------------
default/emp-function-00001-gpn7p[build-step-build]: Removing source code
default/emp-function-00001-gpn7p[build-step-build]:
default/emp-function-00001-gpn7p[build-step-build]: -----> riff Buildpack 0.1.0
default/emp-function-00001-gpn7p[build-step-build]: -----> riff Java Invoker 0.1.3: Contributing to launch
default/emp-function-00001-gpn7p[build-step-build]: Reusing cached download from buildpack
default/emp-function-00001-gpn7p[build-step-build]: Copying to /workspace/io.projectriff.riff/riff-invoker-java/java-function-invoker-0.1.3-exec.jar
default/emp-function-00001-gpn7p[build-step-build]: -----> Process types:
default/emp-function-00001-gpn7p[build-step-build]: web: java -jar /workspace/io.projectriff.riff/riff-invoker-java/java-function-invoker-0.1.3-exec.jar $JAVA_OPTS --function.uri='file:///workspace/app'
default/emp-function-00001-gpn7p[build-step-build]: function: java -jar /workspace/io.projectriff.riff/riff-invoker-java/java-function-invoker-0.1.3-exec.jar $JAVA_OPTS --function.uri='file:///workspace/app'
default/emp-function-00001-gpn7p[build-step-build]:
...
default/emp-function-00001-deployment-66fbd6bf4-bbqpq[user-container]: Hibernate: insert into employee (id, name) values (null, ?)
default/emp-function-00001-deployment-66fbd6bf4-bbqpq[user-container]: 2019-01-22 00:13:53.617 INFO 1 --- [ Thread-4] c.e.empfunctionservice.LoadDatabase : Preloading Employee(id=1, name=pas)
default/emp-function-00001-deployment-66fbd6bf4-bbqpq[user-container]: Hibernate: insert into employee (id, name) values (null, ?)
default/emp-function-00001-deployment-66fbd6bf4-bbqpq[user-container]: 2019-01-22 00:13:53.623 INFO 1 --- [ Thread-4] c.e.empfunctionservice.LoadDatabase : Preloading Employee(id=2, name=lucia)
default/emp-function-00001-deployment-66fbd6bf4-bbqpq[user-container]: Hibernate: insert into employee (id, name) values (null, ?)
default/emp-function-00001-deployment-66fbd6bf4-bbqpq[user-container]: 2019-01-22 00:13:53.628 INFO 1 --- [ Thread-4] c.e.empfunctionservice.LoadDatabase : Preloading Employee(id=3, name=lucas)
default/emp-function-00001-deployment-66fbd6bf4-bbqpq[user-container]: Hibernate: insert into employee (id, name) values (null, ?)
default/emp-function-00001-deployment-66fbd6bf4-bbqpq[user-container]: 2019-01-22 00:13:53.632 INFO 1 --- [ Thread-4] c.e.empfunctionservice.LoadDatabase : Preloading Employee(id=4, name=siena)
default/emp-function-00001-deployment-66fbd6bf4-bbqpq[user-container]: 2019-01-22 00:13:53.704 INFO 1 --- [ Thread-2] o.s.c.f.d.FunctionCreatorConfiguration : Located bean: findEmployee of type class com.example.empfunctionservice.EmpFunctionServiceApplication$$Lambda$791/373359604
pfs function create completed successfully
6. Let's invoke our function as shown below by returning each Employee record using it's ID.
$ pfs service invoke emp-function --text -- -w '\n' -d '1'
curl http://192.168.64.3:32380/ -H 'Host: emp-function.default.example.com' -H 'Content-Type: text/plain' -w '\n' -d 1
Employee(id=1, name=pas)
$ pfs service invoke emp-function --text -- -w '\n' -d '2'
curl http://192.168.64.3:32380/ -H 'Host: emp-function.default.example.com' -H 'Content-Type: text/plain' -w '\n' -d 2
Employee(id=2, name=lucia)
The "pfs service invoke" will show you what an external command will look like to invoke the function service. The IP address here is just the same IP address returned by "minikube ip" as shown below.
$ minikube ip
192.168.64.3
7. Let's view our services using "pfs" CLI
$ pfs service list
NAME STATUS
emp-function Running
hello Running
pfs service list completed successfully
8. Invoking from Postman, ensuring we issue a POST request and pass the correct headers as shown below
More Information
https://docs.pivotal.io/pfs/index.html
Categories: Fusion Middleware