EKS Containers and Services

Managing Containers and Service with EKS and Native Docker Services

For an end-to-end example of creating an EKS Service, see this tutorial.

For a Native Docker Services example, see this tutorial.

Services

Using the Services tab in the DuploCloud Portal (Kubernetes -> Services), you can display and manage the Services you have defined.

For EKS Services, select the Service Name and click the Actions menu to Edit or Delete Services, in addition to performing other actions, as shown below.

Adding a DuploCloud EKS Service

  1. In the DuploCloud Portal, navigate to Kubernetes -> Services for an EKS Service.

  2. Click Add. The Basic Options section of the Add Service page displays.

  3. Complete the fields on the page, including Service Name, Docker Image name, and number of Replicas. Use Allocation Tags to deploy the container in a specific set of hosts.

  4. To force the creation of Kubernetes StatefulSets, select Yes in the Force StatefulSets field.

  1. Click Next. The Advanced Options section of the Add Service page displays.

  2. Configure advanced options as needed. For example, you can implement Kubernetes Lifecycle Hooks, by adding the YAML to the Other Container Config field (optional).

  3. Click Create. The Service is created.

Do not use spaces when creating Service or Docker image names.

The number of Replicas you define must be less than or equal to the number of hosts in the fleet.

Displaying Services

Once the deployment commands run successfully, navigate to Administrator -> Tenants. Select the Tenant from the NAME column. Your deployments are displayed and you can now attach load balancers for the Services.

Starting, stopping, and restarting multiple DuploCloud Services

Using the Services page, you can start, stop, and restart multiple services simultaneously.

  1. In the DuploCloud Portal, navigate to Kubernetes -> Services.

  2. Use the checkbox column to select multiple services you want to start or stop at once.

  3. From the Service Actions menu, select Start Service, Stop Service, or Restart Service.

Your selected services are started, stopped, or restarted as you specified.

Importing a Native Kubernetes Service

Using the Import Kubernetes Deployment pane, you can add a Service to an existing Kubernetes namespace using Kubernetes YAML.

  1. In the DuploCloud Portal, select Kubernetes -> Services from the navigation pane.

  2. Click Add. The Add Service page displays.

  3. Click the Import Kubernetes Deployment button in the upper right. The Import Kubernetes Deployment pane displays.

  4. Paste the deployment YAML code, as in the example below, into the Import Kubernetes Deployment pane.

  5. Click Import.

  6. In the Add Service page, click Next.

  7. Click Create. Your Native Kubernetes Service is created.

Sample YAML code
//apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  namespace: duploservices-my-tenant
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx1
        image: nginx:1.14.2
        ports:
        - containerPort: 80

Advanced configurations with EKS

You can supply advanced configuration options with EKS in the DuploCloud Portal in several ways, including the advanced use cases in this section.

Enable DuploCloud Master IP access to an EKS Security Group

  1. In the DuploCloud Portal, navigate to Administrator -> System Settings.

  2. Click the System Config tab.

  3. Click Add. The Add Config pane displays.

  4. From the Config Type list box, select, Flags.

  5. From the Key list box, select Block Master VPC CIDR Allow in EKS SG.

  6. From the Value list box, select True.

  7. Click Submit. The setting is displayed as BlockMasterVpcCidrAllowInEksSg in the System Config tab.

Kubernetes Containers

You can display and manage the Containers you have defined in the DuploCloud portal. Navigate to Kubernetes -> Containers.

OptionFunctionality

Logs

Displays container logs. When you select this option, the Container Logs window displays. Use the Follow Logs option (enabled by default) to monitor logging in real-time for a running container. See the graphic below for an example of the Container Logs window.

State

Displays container state configuration, in YAML code, in a separate window.

Container Shell

Accesses the Container Shell. To access the Container Shell option, you must first set up Shell access for Docker.

Host Shell

Accesses the Host Shell.

Delete

Deletes the container.

Downloading the Kubectl Token and KubeConfig

Downloading the Kubectl Token and KubeConfig

DuploCloud provides you with a Just-In-Time (JIT) security token, for fifteen minutes, to access the kubectl cluster.

  1. In the DuploCloud Portal, select Administrator -> Infrastructure from the navigation pane.

  2. Select the Infrastructure in the Name column.

  3. Click the EKS tab.

  4. Copy the temporary Token and the Server Endpoint (Kubernetes URL) Values from the Infrastructure that you created. You can also download the complete configuration by clicking the Download Kube Config button.

  5. Run the following commands, in a local Bash shell instance:

> kubectl config --kubeconfig=config-demo set-cluster EKS_CLUSTER --server=[EKS_API_URL] --insecure-skip-tls-verify
> kubectl config --kubeconfig=config-demo set-credentials tempadmin --token=[TOKEN]
> kubectl config --kubeconfig=config-demo set-context EKS --cluster=EKS_CLUSTER --user=tempadmin --namespace=duploservices-[TENANTNAME]
> export KUBECONFIG=config-demo
> kubectl config use-context EKS

You have now configured kubectl to point and access the Kubernetes cluster. You can apply deployment templates by running the following command:

> kubectl apply -f nginx.yaml
nginx.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment-g
  labels:
    app: nginx-deployment-g
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx-deployment-g
  template:
    metadata:
      labels:
        app: nginx-deployment-g
    spec:
      nodeSelector:
        tenantname: "duploservices-stgeast1"
      containers:
      - name: nginx
        image: nginx:latest
        ports:
        - containerPort: 80

If you need security tokens of a longer duration, create them on your own. Secure them outside of the DuploCloud environment.

Passing Kubernetes Configs and Secrets

See this section in the Duplocloud Kubernetes documentation.

Downloading and configuring KubeCtl Token

See this section in the DuploCloud Kubernetes documentation.

Setting Up Docker Registry Credentials

See this section in the DuploCloud documentation.

Add Pod Toleration spec to a Container configuration

See Kubernetes Pod Toleration for examples of specifying K8s YAML for Pod Toleration.

Last updated

Logo

© DuploCloud, Inc. All rights reserved. DuploCloud trademarks used herein are registered trademarks of DuploCloud and affiliates