from https://github.com/hyperhq/pi/releases
$ pi config set-credentials demo --region=gcp-us-central1 \
--access-key="5ZWV9xxxxxxxxxxVO6XG9BD" \
--secret-key="4Okb91DygoRxxxxxxxxxOYqLojFmK5BQlXv"
$ pi info
Region Info:
Region gcp-us-central1
AvailabilityZone gcp-us-central1-b|UP
ServiceClusterIPRange 10.96.0.0/12
Account Info:
Email testuser2@test.com
TenantID ab43de68c97a412e999249c0aff1eef3
DefaultZone gcp-us-central1-b
Resources pod:1/10,volume:2/10,fip:2/10,service:-7/10,secret:1/11
Version Info:
Version
Hash 6c5282a7
Build 2018-04-23T11:55:47+0800
$ pi create volume vol1 --size=1 --zone=gcp-us-central1-b
volume/vol1
$ pi create fip --count=1
fip/35.188.166.216
$ cat examples/pod/pod-nginx.yaml
apiVersion: v1
kind: Pod
metadata:
name: nginx
labels:
app: nginx
role: web
spec:
containers:
- name: nginx
image: oveits/docker-nginx-busybox
volumeMounts:
- name: persistent-storage
mountPath: /data
volumes:
- name: persistent-storage
flexVolume:
options:
volumeID: vol1
$ pi create -f examples/pod/pod-nginx.yaml
$ pi get pods --show-labels
NAME READY STATUS RESTARTS AGE LABELS
nginx 1/1 Running 0 1m app=nginx,role=web
$ pi exec -it nginx -c nginx -- df | grep '/data'
/dev/sda 1998672 245292 1632140 13% /data
$ pi exec -it nginx -c nginx -- ifconfig
eth0 Link encap:Ethernet HWaddr 52:54:01:D8:CD:DB
inet addr:10.244.94.7 Bcast:0.0.0.0 Mask:255.255.0.0
inet6 addr: fe80::5054:1ff:fed8:cddb/64 Scope:Link
UP BROADCAST RUNNING MTU:1400 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:21 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:599 (599.0 B) TX bytes:3312 (3.2 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
$ pi exec -it nginx -c nginx -- sh
/ # uname -r
4.12.4-hyper
/ # exit
$ cat examples/service/service-loadbalancer-nginx.yaml
apiVersion: v1
kind: Service
metadata:
name: test-loadbalancer-nginx
spec:
type: LoadBalancer
loadBalancerIP: 35.188.166.216
selector:
app: nginx
ports:
- name: tcp-80
port: 8080
protocol: TCP
targetPort: 80
- name: tcp-443
port: 6443
protocol: TCP
targetPort: 443
$ pi create -f examples/service/service-loadbalancer-nginx.yaml
$ pi get services
NAME TYPE CLUSTER-IP LOADBALANCER-IP PORT(S) AGE
test-loadbalancer-nginx LoadBalancer 10.109.2.7 35.188.166.216 8080/TCP,6443/TCP 9m
$ curl http://35.188.166.216:8080
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx on busybox!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx on busybox!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>