Pivotal Container

2018-11-29

Pivotal Kubernetes reference

1. PKS Access

1.1 Add Access to Pivotal Operation Manager (OM)

1
2
3
4
5
6
7
8
root@pks-client-vm:~# apt install ruby -y; apt install ruby-dev -y;apt install gcc -y;apt-get install build-essential g++ -y;gem install cf-uaac
root@pks-client-vm:~# uaac version
root@pks-client-vm:~# uaac target https://pks.lab.corp.local:8443 --skip-ssl-validation
root@pks-client-vm:~# uaac token client get admin -s HFvA3WXb2FKlAHexd-aCuDY9qsTukM4t
root@pks-client-vm:~# uaac user add teddy --emails teddy@corp.local -p VMware1!
root@pks-client-vm:~# uaac user add setiawan --emails setiawan@corp.local -p VMware1!
root@pks-client-vm:~# uaac member add pks.clusters.admin teddy
root@pks-client-vm:~# uaac member add pks.clusters.manage setiawan

2. PKS Create Kubernetes Cluster

2.1 PKS Login

1
root@pks-client-vm:~# pks login -a pks.lab.corp.local -u teddy -p VMware1! -k

2.2 PKS Create Kubernetes Cluster

1
root@pks-client-vm:~# pks create-cluster pks-cluster-1 --external-hostname pks-cluster-1 --plan small --num-nodes 1

2.3 PKS List Cluster

1
root@pks-client-vm:~# pks list-clusters

3. PKS Accessing Kubernetes Cluster

3.1 Accessing Kubernetes Cluster from PKS

1
root@pks-client-vm:~# pks get-credentials pks-cluster-1

3.2 Kubernetes Dashboard

1
root@pks-client-vm:~#kubectl proxy

From local browser, open local kubernetes dashboard

3.3 Kubernetes get number of nodes

1
2
3
4
5

root@pks-client-vm:~# kubectl get nodes -o wide

NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
a21b7944-9c2a-4e2d-99d9-59c4031c8f97 Ready <none> 16h v1.11.3 172.160.0.3 172.160.0.3 Ubuntu 16.04.5 LTS 4.15.0-39-generic docker://17.12.1-ce

3.4 Resize Kubernetes Cluster

1
root@pks-client-vm:~# pks resize pks-cluster-1 --num-nodes 2

Check again number of nodes after PKS cluster resizing

1
2
3
4
root@pks-client-vm:~# kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
7a1f03d4-5288-4d72-afaf-60b04cf5c986 Ready <none> 2m v1.11.3 172.160.0.5 172.160.0.5 Ubuntu 16.04.5 LTS 4.15.0-39-generic docker://17.12.1-ce
a21b7944-9c2a-4e2d-99d9-59c4031c8f97 Ready <none> 16h v1.11.3 172.160.0.3 172.160.0.3 Ubuntu 16.04.5 LTS 4.15.0-39-generic docker://17.12.1-ce

4. Debugging PKS Deployment

4.1 Bosh environments

1
2
3
4
5
6
7
root@pks-client-vm:~# cat BOSH.env
export BOSH_CLIENT=ops_manager
export BOSH_CLIENT_SECRET=I0X7owXQf4AXIR9fst-Aa-3-UCvdXjEl
export BOSH_CA_CERT=/root/opsmanager.pem
export BOSH_ENVIRONMENT=172.31.0.3

root@pks-client-vm:~# source BOSH.env

4.2 Get Tasks

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
root@pks-client-vm:~# bosh tasks
Using environment '172.31.0.3' as client 'ops_manager'

ID State Started At Last Activity At User Deployment Description Result
427 processing Thu Nov 29 02:00:28 UTC 2018 Thu Nov 29 02:00:28 UTC 2018 pivotal-container-service-cec942fc58e9825b0431 service-instance_aafe11c2-cbb3-4024-af40-2c1259cc84f5 create deployment -

1 tasks

Succeeded

root@pks-client-vm:~# bosh deployments
Using environment '172.31.0.3' as client 'ops_manager'

Name Release(s) Stemcell(s) Team(s)
harbor-container-registry-af768fafc21927eaec3d bosh-dns/1.10.0 bosh-vsphere-esxi-ubuntu-xenial-go_agent/97.34 -
harbor-container-registry/1.6.0-build.35
pivotal-container-service-cec942fc58e9825b0431 backup-and-restore-sdk/1.8.0 bosh-vsphere-esxi-ubuntu-xenial-go_agent/97.34 -
bosh-dns/1.10.0
bpm/0.6.0
cf-mysql/36.14.0
cfcr-etcd/1.4.1
docker/32.0.3
event-emitter/0.13.0
harbor-container-registry/1.6.0-build.35
kubo/0.21.1
kubo-service-adapter/1.2.1-build.8
nsx-cf-cni/2.3.0.10066840
on-demand-service-broker/0.23.0
pks-api/1.2.1-build.8
pks-helpers/50.0.0
pks-nsx-t/1.12.0
pks-telemetry/0.9.2
pks-vrli/0.6.0
syslog-migration/11.1.1
uaa/60.8
wavefront-proxy/0.9.0
service-instance_69e4fc43-198b-4e7d-b482-1d5da4f9759f bosh-dns/1.10.0 bosh-vsphere-esxi-ubuntu-xenial-go_agent/97.34 pivotal-container-service-cec942fc58e9825b0431
bpm/0.6.0
cfcr-etcd/1.4.1
docker/32.0.3
harbor-container-registry/1.6.0-build.35
kubo/0.21.1
nsx-cf-cni/2.3.0.10066840
pks-helpers/50.0.0
pks-nsx-t/1.12.0
pks-telemetry/0.9.2
pks-vrli/0.6.0
syslog-migration/11.1.1
wavefront-proxy/0.9.0
service-instance_aafe11c2-cbb3-4024-af40-2c1259cc84f5 bosh-dns/1.10.0 bosh-vsphere-esxi-ubuntu-xenial-go_agent/97.34 pivotal-container-service-cec942fc58e9825b0431
bpm/0.6.0
cfcr-etcd/1.4.1
docker/32.0.3
harbor-container-registry/1.6.0-build.35
kubo/0.21.1
nsx-cf-cni/2.3.0.10066840
pks-helpers/50.0.0
pks-nsx-t/1.12.0
pks-telemetry/0.9.2
pks-vrli/0.6.0
syslog-migration/11.1.1
wavefront-proxy/0.9.0

4 deployments

Succeeded
root@pks-client-vm:~# bosh -d service-instance_aafe11c2-cbb3-4024-af40-2c1259cc84f5 tasks
Using environment '172.31.0.3' as client 'ops_manager'

ID State Started At Last Activity At User Deployment Description Result
427 processing Thu Nov 29 02:00:28 UTC 2018 Thu Nov 29 02:00:28 UTC 2018 pivotal-container-service-cec942fc58e9825b0431 service-instance_aafe11c2-cbb3-4024-af40-2c1259cc84f5 create deployment -

1 tasks

Succeeded

4.3 Get Bosh / PKS Deployment

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
root@pks-client-vm:~# bosh -d service-instance_aafe11c2-cbb3-4024-af40-2c1259cc84f5 instances
Using environment '172.31.0.3' as client 'ops_manager'

Task 429. Done

Deployment 'service-instance_aafe11c2-cbb3-4024-af40-2c1259cc84f5'

Instance Process State AZ IPs
apply-addons/a764f781-edec-45e3-af5f-34faacf092d3 - AZ-PAYLOAD -
master/8c03edb3-d7cf-422c-9d0c-1d9779e6ce64 running AZ-PAYLOAD 172.160.0.2
worker/433152bf-bf92-4589-97e1-3a5ee4c060d2 running AZ-PAYLOAD 172.160.0.5
worker/5d5873b8-1d31-4e6e-aeac-368c9dfe7c24 running AZ-PAYLOAD 172.160.0.3

4 instances

Succeeded

4.4 Get Task information

1
2
3
4
5
6
7
8
9
10
11
12
root@pks-client-vm:~# bosh -d service-instance_aafe11c2-cbb3-4024-af40-2c1259cc84f5 task 427
Using environment '172.31.0.3' as client 'ops_manager'

Task 427

Task 427 | 02:00:29 | Preparing deployment: Preparing deployment
Task 427 | 02:00:31 | Warning: DNS address not available for the link provider instance: pivotal-container-service/1d4eb02b-6219-4864-9f42-c816d426e766
Task 427 | 02:00:31 | Warning: DNS address not available for the link provider instance: pivotal-container-service/1d4eb02b-6219-4864-9f42-c816d426e766
Task 427 | 02:00:42 | Preparing deployment: Preparing deployment (00:00:13)
Task 427 | 02:01:09 | Preparing package compilation: Finding packages to compile (00:00:00)
Task 427 | 02:01:09 | Creating missing vms: worker/433152bf-bf92-4589-97e1-3a5ee4c060d2 (1) (00:03:03)
Task 427 | 02:04:13 | Updating instance worker: worker/433152bf-bf92-4589-97e1-3a5ee4c060d2 (1) (canary)

For getting debut detail, use:

1
root@pks-client-vm:~# bosh -d service-instance_aafe11c2-cbb3-4024-af40-2c1259cc84f5 task 427 --debug

`