官术网_书友最值得收藏!

Application layer – interacting with the cluster

Finally, we have the application layer where containerized applications run using platform APIs (Swarm or Kubernetes) to describe and deploy them, as described earlier in Figure 2.

Now, we'll build on what we have learned and done during our tour of the platform layer and discuss deploying the application in a little more detail. Back at the platform layer, when creating users, let's say we created a user name John Doe and granted him "full control" to his private collection of developer resources. Now, he is able to deploy Swarm and Kubernetes resources to his personal (sandbox) space, but how does it actually work?

  1. The system admin provides John with his UCP credentials.
  2. John is able to log in to the cluster, but only sees what he's deployed to the cluster, which is nothing so far.
  3. In Figure 3, John opens his profile in UCP Web UI and downloads a client bundle. The bundle contains some certificates and scripts (for both Linux and Windows) to securely connect the desktop shell to the cluster Swarm and Kubernetes APIs:
Figure 3 UCP client bundle download
  1. John unzips the files and runs the connect script using either Import-module or source commands with PowerShell bash shell script files. John's local $docker and $kubectl commands now execute against the remote cluster, but are of course subject to his RBAC access rights.
  2. John now runs the $docker stack deploy or $kubectl create commands, using the YAML file he built for his application, and deploys his application to the cluster.
  3. See the following sample YAML file for a Kubernetes application use a $kubectl create -f nginx-deployment.yml from a command-line bundle:
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
replicas: 3
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
  1. In the previous sample code, three Kubernetes pods are deployed into the cluster, each containing an nginx container. Running $kubectl get pods command shows the running pods as follows:
NAME                                  READY   STATUS  RESTARTS  AGE
nginx-deployment-75675f5897-45dvt 1/1 Running 0 26s
nginx-deployment-75675f5897-hrgmg 1/1 Running 0 26s
nginx-deployment-75675f5897-vskh8 1/1 Running 0 26s
  1. The $kubectl get pods command lists all three nginx replica pods running in the default namespace, each with 1 of 1 containers ready, and each pod status is Running.
主站蜘蛛池模板: 五华县| 宝清县| 监利县| 青海省| 尉犁县| 康乐县| 宣汉县| 新干县| 兴安盟| 昭觉县| 福建省| 松原市| 泽库县| 安徽省| 伊通| 利津县| 隆德县| 松滋市| 达尔| 屯昌县| 扎鲁特旗| 岑溪市| 祁东县| 延庆县| 米林县| 苏尼特右旗| 玉溪市| 灵丘县| 铜鼓县| 丰顺县| 墨脱县| 仁化县| 伊吾县| 玛纳斯县| 深泽县| 彭水| 青铜峡市| 澜沧| 荥经县| 昌吉市| 楚雄市|