mirror of https://github.com/docker/docs.git
First draft of DTR-to-Kube topic (#283)
* First draft of DTR to Kube topic * Incorporate feedback
This commit is contained in:
parent
c05e7270b2
commit
102bd521ac
|
@ -325,6 +325,13 @@ guides:
|
||||||
title: DTR architecture
|
title: DTR architecture
|
||||||
- path: /deploy/architecture/ucp-architecture/
|
- path: /deploy/architecture/ucp-architecture/
|
||||||
title: UCP architecture
|
title: UCP architecture
|
||||||
|
- sectiontitle: Deploy workloads
|
||||||
|
section:
|
||||||
|
- path: /deploy/deploy-workloads/deploy-kubernetes-workload/
|
||||||
|
title: Deploy a workload to a Kubernetes cluster
|
||||||
|
- path: /deploy/deploy-workloads/manage-and-deploy-private-images/
|
||||||
|
title: Manage and deploy private images
|
||||||
|
|
||||||
|
|
||||||
- sectiontitle: Run your app in production
|
- sectiontitle: Run your app in production
|
||||||
section:
|
section:
|
||||||
|
|
|
@ -1,285 +1,269 @@
|
||||||
---
|
---
|
||||||
title: Deploy a workload to a Kubernetes cluster
|
title: Deploy a workload to a Kubernetes cluster
|
||||||
description: |
|
description: |
|
||||||
Use Docker Enterprise Edition to deploy Kubernetes workloads from yaml files.
|
Use Docker Enterprise Edition to deploy Kubernetes workloads from yaml files.
|
||||||
keywords: UCP, Docker EE, orchestration, Kubernetes, cluster
|
keywords: UCP, Docker EE, orchestration, Kubernetes, cluster
|
||||||
redirect_from:
|
redirect_from:
|
||||||
- /ucp/
|
- /ucp/
|
||||||
ui_tabs:
|
ui_tabs:
|
||||||
- version: ucp-3.0
|
- version: ucp-3.0
|
||||||
orhigher: true
|
orhigher: true
|
||||||
cli_tabs:
|
cli_tabs:
|
||||||
- version: kubectl
|
- version: kubectl
|
||||||
next_steps:
|
next_steps:
|
||||||
- path: /engine/install
|
- path: /engine/install
|
||||||
title: Install Docker
|
title: Install Docker
|
||||||
- path: /get-started/
|
- path: /get-started/
|
||||||
title: Get Started with Docker
|
title: Get Started with Docker
|
||||||
---
|
---
|
||||||
|
|
||||||
{% if include.ui %}
|
{% if include.ui %}
|
||||||
The Docker EE web UI enables deploying your Kubernetes YAML files. In most
|
The Docker EE web UI enables deploying your Kubernetes YAML files. In most
|
||||||
cases, no modifications are necessary to deploy on a cluster that's managed by
|
cases, no modifications are necessary to deploy on a cluster that's managed by
|
||||||
Docker EE.
|
Docker EE.
|
||||||
|
|
||||||
## Deploy an NGINX server
|
## Deploy an NGINX server
|
||||||
|
|
||||||
In this example, a simple Kubernetes Deployment object for an NGINX server is
|
In this example, a simple Kubernetes Deployment object for an NGINX server is
|
||||||
defined in YAML:
|
defined in YAML:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: apps/v1beta2
|
apiVersion: apps/v1beta2
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: nginx-deployment
|
name: nginx-deployment
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: nginx
|
app: nginx
|
||||||
replicas: 2
|
replicas: 2
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: nginx
|
app: nginx
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: nginx
|
- name: nginx
|
||||||
image: nginx:1.7.9
|
image: nginx:1.7.9
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
```
|
```
|
||||||
|
|
||||||
The YAML specifies an earlier version of NGINX, which will be updated in a
|
The YAML specifies an earlier version of NGINX, which will be updated in a
|
||||||
later section.
|
later section.
|
||||||
|
|
||||||
1. Open the Docker EE web UI, and in the left pane, click **Kubernetes**.
|
1. Open the Docker EE web UI, and in the left pane, click **Kubernetes**.
|
||||||
2. Click **Create** to open the **Create Kubernetes Object** page.
|
2. Click **Create** to open the **Create Kubernetes Object** page.
|
||||||
3. In the **Namespace** dropdown, select **default**.
|
3. In the **Namespace** dropdown, select **default**.
|
||||||
4. In the **Object YAML** editor, paste the previous YAML.
|
4. In the **Object YAML** editor, paste the previous YAML.
|
||||||
5. Click **Create**.
|
5. Click **Create**.
|
||||||
|
|
||||||
{: .with-border}
|
{: .with-border}
|
||||||
|
|
||||||
## Inspect the deployment
|
## Inspect the deployment
|
||||||
|
|
||||||
The Docker EE web UI shows the status of your deployment when you click the
|
The Docker EE web UI shows the status of your deployment when you click the
|
||||||
links in the **Kubernetes** section of the left pane.
|
links in the **Kubernetes** section of the left pane.
|
||||||
|
|
||||||
1. In the left pane. click **Controllers** to see the resource controllers
|
1. In the left pane. click **Controllers** to see the resource controllers
|
||||||
that Docker EE created for the NGINX server.
|
that Docker EE created for the NGINX server.
|
||||||
2. Click the **nginx-deployment** controller, and in the details pane, scroll
|
2. Click the **nginx-deployment** controller, and in the details pane, scroll
|
||||||
to the **Template** section. This shows the values that Docker EE used to
|
to the **Template** section. This shows the values that Docker EE used to
|
||||||
create the deployment.
|
create the deployment.
|
||||||
3. In the left pane, click **Pods** to see the pods that are provisioned for
|
3. In the left pane, click **Pods** to see the pods that are provisioned for
|
||||||
the NGINX server. Click one of the pods, and in the details pane, scroll to
|
the NGINX server. Click one of the pods, and in the details pane, scroll to
|
||||||
the **Status** section to see that pod's phase, IP address, and other
|
the **Status** section to see that pod's phase, IP address, and other
|
||||||
properties.
|
properties.
|
||||||
|
|
||||||
{: .with-border}
|
{: .with-border}
|
||||||
|
|
||||||
## Expose the server
|
## Expose the server
|
||||||
|
|
||||||
The NGINX server is up and running, but it's not accessble from outside of the
|
The NGINX server is up and running, but it's not accessble from outside of the
|
||||||
cluster. Add a `NodePort` service to expose the server on a specified port:
|
cluster. Add a `NodePort` service to expose the server on a specified port:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: nginx
|
name: nginx
|
||||||
labels:
|
labels:
|
||||||
app: nginx
|
app: nginx
|
||||||
spec:
|
spec:
|
||||||
type: NodePort
|
type: NodePort
|
||||||
ports:
|
ports:
|
||||||
- port: 80
|
- port: 80
|
||||||
nodePort: 30080
|
nodePort: 30080
|
||||||
selector:
|
selector:
|
||||||
app: nginx
|
app: nginx
|
||||||
```
|
```
|
||||||
|
|
||||||
The service connects the cluster's internal port 80 to the external port
|
The service connects the cluster's internal port 80 to the external port
|
||||||
30080.
|
30080.
|
||||||
|
|
||||||
1. Repeat the previous steps and copy-paste the YAML that defines the `nginx`
|
1. Repeat the previous steps and copy-paste the YAML that defines the `nginx`
|
||||||
service into the **Object YAML** editor on the
|
service into the **Object YAML** editor on the
|
||||||
**Create Kubernetes Object** page. When you click **Create**, the
|
**Create Kubernetes Object** page. When you click **Create**, the
|
||||||
**Load Balancers** page opens.
|
**Load Balancers** page opens.
|
||||||
2. Click the **nginx** service, and in the details pane, find the **Ports**
|
2. Click the **nginx** service, and in the details pane, find the **Ports**
|
||||||
section.
|
section.
|
||||||
3. Click the link that's labeled **URL** to
|
3. Click the link that's labeled **URL** to
|
||||||
|
|
||||||
{: .with-border}
|
{: .with-border}
|
||||||
|
|
||||||
The YAML definition connects the service to the NGINX server by using the
|
The YAML definition connects the service to the NGINX server by using the
|
||||||
app label `nginx` and a corresponding label selector.
|
app label `nginx` and a corresponding label selector.
|
||||||
[Learn about using a service to expose your app](https://kubernetes.io/docs/tutorials/kubernetes-basics/expose-intro/).
|
[Learn about using a service to expose your app](https://kubernetes.io/docs/tutorials/kubernetes-basics/expose-intro/).
|
||||||
|
|
||||||
## Update the deployment
|
## Update the deployment
|
||||||
|
|
||||||
Update an existing deployment by applying an updated YAML file. In this
|
Update an existing deployment by applying an updated YAML file. In this
|
||||||
example, the server is scaled up to four replicas and updated to a later
|
example, the server is scaled up to four replicas and updated to a later
|
||||||
version of NGINX.
|
version of NGINX.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
...
|
...
|
||||||
spec:
|
spec:
|
||||||
progressDeadlineSeconds: 600
|
progressDeadlineSeconds: 600
|
||||||
replicas: 4
|
replicas: 4
|
||||||
revisionHistoryLimit: 10
|
revisionHistoryLimit: 10
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: nginx
|
app: nginx
|
||||||
strategy:
|
strategy:
|
||||||
rollingUpdate:
|
rollingUpdate:
|
||||||
maxSurge: 25%
|
maxSurge: 25%
|
||||||
maxUnavailable: 25%
|
maxUnavailable: 25%
|
||||||
type: RollingUpdate
|
type: RollingUpdate
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
creationTimestamp: null
|
creationTimestamp: null
|
||||||
labels:
|
labels:
|
||||||
app: nginx
|
app: nginx
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- image: nginx:1.8
|
- image: nginx:1.8
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
1. In the left pane, click **Controllers** and select the **nginx-deployment**
|
1. In the left pane, click **Controllers** and select the **nginx-deployment**
|
||||||
controller.
|
controller.
|
||||||
2. In the details pane, click **Configure**, and in the **Edit Deployment**
|
2. In the details pane, click **Configure**, and in the **Edit Deployment**
|
||||||
page, find the **replicas: 2** entry.
|
page, find the **replicas: 2** entry.
|
||||||
3. Change the number of replicas to 4, so the line reads **replicas: 4**.
|
3. Change the number of replicas to 4, so the line reads **replicas: 4**.
|
||||||
4. Find the **image: nginx:1.7.9** entry and change it to **image: nginx:1.8**.
|
4. Find the **image: nginx:1.7.9** entry and change it to **image: nginx:1.8**.
|
||||||
5. Click **Edit** to update the deployment with the new YAML.
|
5. Click **Edit** to update the deployment with the new YAML.
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if include.cli %}
|
{% if include.cli %}
|
||||||
With Docker EE, you deploy your Kubernetes objects on the command line by using
|
With Docker EE, you deploy your Kubernetes objects on the command line by using
|
||||||
`kubectl`. [Install and set up kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/).
|
`kubectl`. [Install and set up kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/).
|
||||||
|
|
||||||
Docker EE ensures that communication with the cluster is secure. When you run
|
Use a client bundle to configure your client tools, like Docker CLI and `kubctl`
|
||||||
`kubectl` commands on a Docker EE node, you need to authenticate your request
|
to communicate with UCP instead of the local deployments you might have running.
|
||||||
with a client certificate bundle. [Get your client bundle by using the Docker EE web UI or the command line](/datacenter/ucp/2.2/guides/user/access-ucp/cli-based-access.md).
|
[Get your client bundle by using the Docker EE web UI or the command line](/datacenter/ucp/2.2/guides/user/access-ucp/cli-based-access.md).
|
||||||
If you don't have the client bundle set up, you'll see an error when you run
|
|
||||||
`kubectl` commands:
|
When you have the client bundle set up, you can deploy a Kubernetes object
|
||||||
|
from YAML.
|
||||||
```none
|
|
||||||
The connection to the server localhost:8080 was refused - did you specify the right host or port?
|
```yaml
|
||||||
```
|
apiVersion: apps/v1beta2
|
||||||
|
kind: Deployment
|
||||||
When you have `kubectl` and the client bundle installed, you can deploy a
|
metadata:
|
||||||
Kubernetes object from YAML.
|
name: nginx-deployment
|
||||||
|
spec:
|
||||||
```yaml
|
selector:
|
||||||
apiVersion: apps/v1beta2
|
matchLabels:
|
||||||
kind: Deployment
|
app: nginx
|
||||||
metadata:
|
replicas: 2
|
||||||
name: nginx-deployment
|
template:
|
||||||
spec:
|
metadata:
|
||||||
selector:
|
labels:
|
||||||
matchLabels:
|
app: nginx
|
||||||
app: nginx
|
spec:
|
||||||
replicas: 2
|
containers:
|
||||||
template:
|
- name: nginx
|
||||||
metadata:
|
image: nginx:1.7.9
|
||||||
labels:
|
ports:
|
||||||
app: nginx
|
- containerPort: 80
|
||||||
spec:
|
---
|
||||||
containers:
|
apiVersion: v1
|
||||||
- name: nginx
|
kind: Service
|
||||||
image: nginx:1.7.9
|
metadata:
|
||||||
ports:
|
name: nginx
|
||||||
- containerPort: 80
|
labels:
|
||||||
---
|
app: nginx
|
||||||
apiVersion: v1
|
spec:
|
||||||
kind: Service
|
type: NodePort
|
||||||
metadata:
|
ports:
|
||||||
name: nginx
|
- port: 80
|
||||||
labels:
|
nodePort: 30080
|
||||||
app: nginx
|
selector:
|
||||||
spec:
|
app: nginx
|
||||||
type: NodePort
|
```
|
||||||
ports:
|
|
||||||
- port: 80
|
Save the previous YAML to a file named "deployment.yaml", and use the following
|
||||||
nodePort: 30080
|
command to deploy the NGINX server:
|
||||||
selector:
|
|
||||||
app: nginx
|
```bash
|
||||||
```
|
kubectl apply -f deployment.yaml
|
||||||
|
```
|
||||||
Save the previous YAML to a file named "deployment.yaml", and use the following
|
|
||||||
command to deploy the NGINX server:
|
## Inspect the deployment
|
||||||
|
|
||||||
```bash
|
Use the `describe deployment` option to inspect the deployment:
|
||||||
kubectl apply -f deployment.yaml
|
|
||||||
```
|
```bash
|
||||||
|
kubectl describe deployment nginx-deployment
|
||||||
## Inspect the deployment
|
```
|
||||||
|
|
||||||
Use the `describe deployment` option to inspect the deployment:
|
Also, you can use the Docker EE web UI to see the deployment's pods and
|
||||||
|
controllers.
|
||||||
```bash
|
|
||||||
kubectl describe deployment nginx-deployment
|
## Update the deployment
|
||||||
```
|
|
||||||
|
Update an existing deployment by applying an updated YAML file.
|
||||||
Also, you can use the Docker EE web UI to see the deployment's pods and
|
|
||||||
controllers.
|
Edit deployment.yaml and change the following lines:
|
||||||
|
|
||||||
## Update the deployment
|
- Increase the number of replicas to 4, so the line reads **replicas: 4**.
|
||||||
|
- Update the NGINX version by specifying **image: nginx:1.8**.
|
||||||
Update an existing deployment by applying an updated YAML file.
|
|
||||||
|
Save the edited YAML to a file named "update.yaml", and use the following
|
||||||
Edit deployment.yaml and change the following lines:
|
command to deploy the NGINX server:
|
||||||
|
|
||||||
- Increase the number of replicas to 4, so the line reads **replicas: 4**.
|
```bash
|
||||||
- Update the NGINX version by specifying **image: nginx:1.8**.
|
kubectl apply -f update.yaml
|
||||||
|
```
|
||||||
Save the edited YAML to a file named "update.yaml", and use the following
|
|
||||||
command to deploy the NGINX server:
|
Check that the deployment was scaled out by listing the deployments in the
|
||||||
|
cluster:
|
||||||
```bash
|
|
||||||
kubectl apply -f update.yaml
|
```bash
|
||||||
```
|
kubectl get deployments
|
||||||
|
```
|
||||||
Check that the deployment was scaled out by listing the pods in the cluster:
|
|
||||||
|
You should see four pods in the deployment:
|
||||||
```bash
|
|
||||||
kubectl get pods
|
```bash
|
||||||
```
|
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
|
||||||
|
nginx-deployment 4 4 4 4 2d
|
||||||
You should see four pods listed:
|
```
|
||||||
|
|
||||||
```bash
|
Check that the pods are running the updated image:
|
||||||
NAME READY STATUS RESTARTS AGE
|
|
||||||
nginx-deployment-f95b7b6b8-74dfp 1/1 Running 0 21m
|
```bash
|
||||||
nginx-deployment-f95b7b6b8-hd2bt 1/1 Running 0 21m
|
kubectl describe deployment nginx-deployment | grep -i image
|
||||||
nginx-deployment-f95b7b6b8-mz925 1/1 Running 0 21m
|
```
|
||||||
nginx-deployment-f95b7b6b8-qgrzm 1/1 Running 0 21m
|
|
||||||
```
|
You should see the currently running image:
|
||||||
|
|
||||||
Check that the pods are running the updated image:
|
```bash
|
||||||
|
Image: nginx:1.8
|
||||||
```bash
|
```
|
||||||
kubectl describe po/nginx-deployment-f95b7b6b8-74dfp | grep -i image
|
|
||||||
```
|
{% endif %}
|
||||||
|
|
||||||
> kubectl tip
|
|
||||||
>
|
|
||||||
> Remember to prepend `po/` to the pod's name.
|
|
||||||
|
|
||||||
You should see the running image and messages about pulling the updated image:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
Image: nginx:1.8
|
|
||||||
Image ID: docker-pullable://nginx@sha256:c97ee70c4048fe79765f7c2ec0931957c2898f47400128f4f3640d0ae5d60d10
|
|
||||||
Normal Pulling 26m kubelet, vs9gg6dhn5pklhqfk9fgzawuu pulling image "nginx:1.8"
|
|
||||||
Normal Pulled 26m kubelet, vs9gg6dhn5pklhqfk9fgzawuu Successfully pulled image "nginx:1.8"
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,139 @@
|
||||||
|
---
|
||||||
|
title: Manage and deploy private images
|
||||||
|
description: |
|
||||||
|
Learn how to push an image to Docker Trusted Registry and deploy it to a Kubernetes cluster managed by Docker Enterprise Edition.
|
||||||
|
keywords: Docker EE, DTR, UCP, image, Kubernetes, orchestration, cluster
|
||||||
|
next_steps:
|
||||||
|
- path: /deploy/allow-creation-on-push
|
||||||
|
title: Allow users to create repositories when pushing
|
||||||
|
---
|
||||||
|
|
||||||
|
Docker Enterprise Edition (EE) has its own image registry (DTR) so that
|
||||||
|
you can store and manage the images that you deploy to your cluster.
|
||||||
|
In this topic, you push an image to DTR and later deploy it to your cluster,
|
||||||
|
using the Kubernetes orchestrator.
|
||||||
|
|
||||||
|
## Open the DTR web UI
|
||||||
|
|
||||||
|
1. In the Docker EE web UI, click **Admin Settings**.
|
||||||
|
2. In the left pane, click **Docker Trusted Registry**.
|
||||||
|
3. In the **Installed DTRs** section, note the URL of your cluster's DTR
|
||||||
|
instance.
|
||||||
|
|
||||||
|
{: .with-border}
|
||||||
|
|
||||||
|
4. In a new browser tab, enter the URL to open the DTR web UI.
|
||||||
|
|
||||||
|
## Create an image repository
|
||||||
|
|
||||||
|
1. In the DTR web UI, click **Repositories**.
|
||||||
|
2. Click **New Repository**, and in the **Repository Name** field, enter
|
||||||
|
"wordpress".
|
||||||
|
3. Click **Save** to create the repository.
|
||||||
|
|
||||||
|
{: .with-border}
|
||||||
|
|
||||||
|
## Push an image to DTR
|
||||||
|
|
||||||
|
Instead of building an image from scratch, we'll pull the official Wordpress
|
||||||
|
image from Docker Hub, tag it, and push it to DTR. Once that wordpress version
|
||||||
|
is in DTR, only authorized users can change it.
|
||||||
|
|
||||||
|
To push images to DTR, you need CLI access to a licensed installation of
|
||||||
|
Docker EE.
|
||||||
|
|
||||||
|
- [License your installation](/datacenter/ucp/2.2/guides/admin/configure/license-your-installation.md).
|
||||||
|
- [Set up your Docker CLI](/datacenter/ucp/2.2/guides//user/access-ucp/cli-based-access.md).
|
||||||
|
|
||||||
|
When you're set up for CLI-based access to a licensed Docker EE instance,
|
||||||
|
you can push images to DTR.
|
||||||
|
|
||||||
|
1. Pull the public WordPress image from Docker Hub:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker pull wordpress
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Tag the image, using the IP address or DNS name of your DTR instance:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker tag wordpress:latest 54.218.110.183:444/admin/wordpress:latest
|
||||||
|
```
|
||||||
|
3. Log in to a Docker EE manager node.
|
||||||
|
4. Push the tagged image to DTR:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker image push <dtr-url>:<port>/admin/wordpress:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
## Confirm the image push
|
||||||
|
|
||||||
|
In the DTR web UI, confirm that the `wordpress:latest` image is store in your
|
||||||
|
DTR instance.
|
||||||
|
|
||||||
|
1. In the DTR web UI, click **Repositories**.
|
||||||
|
2. Click **wordpress** to open the repo.
|
||||||
|
3. Click **Images** to view the stored images.
|
||||||
|
4. Confirm that the `latest` tag is present.
|
||||||
|
|
||||||
|
{: .with-border}
|
||||||
|
|
||||||
|
You're ready to deploy the `wordpress:latest` image into production.
|
||||||
|
|
||||||
|
## Deploy the private image to UCP
|
||||||
|
|
||||||
|
With the WordPress image stored in DTR, Docker EE can deploy the image to a
|
||||||
|
Kubernetes cluster with a simple Deployment object:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: apps/v1beta2
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: wordpress-deployment
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: wordpress
|
||||||
|
replicas: 2
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: wordpress
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: wordpress
|
||||||
|
image: <dtr-url>:<port>/admin/wordpress:latest
|
||||||
|
ports:
|
||||||
|
- containerPort: 80
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: wordpress-service
|
||||||
|
labels:
|
||||||
|
app: wordpress
|
||||||
|
spec:
|
||||||
|
type: NodePort
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
nodePort: 30081
|
||||||
|
selector:
|
||||||
|
app: wordpress
|
||||||
|
```
|
||||||
|
|
||||||
|
The Deployment object's YAML specifies your DTR image in the pod template spec:
|
||||||
|
`image: <dtr-url>:<port>/admin/wordpress:latest`. Also, the YAML file defines
|
||||||
|
a `NodePort` service that exposes the WordPress application, so it's accessible
|
||||||
|
from outside the cluster.
|
||||||
|
|
||||||
|
1. Open the Docker EE web UI, and in the left pane, click **Kubernetes**.
|
||||||
|
2. Click **Create** to open the **Create Kubernetes Object** page.
|
||||||
|
3. In the **Namespace** dropdown, select **default**.
|
||||||
|
4. In the **Object YAML** editor, paste the Deployment object's YAML.
|
||||||
|
5. Click **Create**. When the Kubernetes objects are created,
|
||||||
|
the **Load Balancers** page opens.
|
||||||
|
6. Click **wordpress-service**, and in the details pane, find the **Ports**
|
||||||
|
section.
|
||||||
|
7. Click the URL to open the default WordPress home page.
|
||||||
|
|
||||||
|
{: .with-border}
|
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
Binary file not shown.
After Width: | Height: | Size: 50 KiB |
Binary file not shown.
After Width: | Height: | Size: 53 KiB |
Binary file not shown.
After Width: | Height: | Size: 80 KiB |
Loading…
Reference in New Issue