Create network spec network.yaml with subnet 192.168.0.0/24
This operation will create a new Neutron network with a default router and a subnet 192.168.0.0/24 automatically.
Manage namespace
You can create a namespace with or without network. A namespace without network is only suggested for administration because there is no network isolation. For users, a network is required to create a namespace.
Create namespace spec namespace.yaml and set its network to net1
Manage Pod
Create Pod spec pod-ns1.yaml and set its namespace to ns1
Manage Pod with Cinder volume
Hypernetes Volumes support native Cinder volumes (only rbd backend is supported now), which means that you can simply create a Pod with Cinder volume. A sample Pod with Cinder volume 651b2a7b-683e-47e1-bdd6-e3c62e8f91c0 is
Manage service
Create a service spec nginx-ns1.yaml with namespace ns1 and type NetworkProvider (Service must be type NetworkProvider if its namespace is with a network):
Cluster service 10.254.223.206:8078 can be only visited on Pods in namespace ns1.
Now let's create another service nginx2-ns1.yaml. It's the same configuration as nginx service, but with externalIP 23.23.0.30
Notes about service nginx2
Cluster service 10.254.154.51:8078 can be only visited on Pods in namespace ns1
External ip 192.168.0.4 can be visited on all Pods in the same network net1, since it is the vip internal load balancer's network
External ip 23.23.0.30 can be visited on public since it is a public IP
# kubectl create -f ./network.yaml
network "net1" created
# kubectl get network
NAME SUBNETS PROVIDERNETWORKID LABELS STATUS
net1 192.168.0.0/24 <none> Active
# kubectl create -f ./namespace.yaml
namespace "ns1" created
# kubectl get namespace
NAME LABELS STATUS AGE
default <none> Active 30d
ns1 <none> Active 6m
# kubectl create -f ./nginx-ns1.yaml
service "nginx" created
# kubectl --namespace=ns1 get svc nginx
NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE
nginx 10.254.223.206 8078/TCP app=nginx 10m