---
title: Kubernetes Installation
slug: manufacturing-connect-edge/kubernetes-installation
docTags: 
createdAt: 2022-04-11T16:12:28.000Z
---

You can use Kubernetes to install Manufacturing Connect Edge. 

# Before you begin

- Get access to a configured Kubernetes cluster.
- Get access to PersistentVolumeClaim (PVC). Learn more about [Persistent Volumes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) from the Kubernetes documentation.&#x20;
- Get administrative permissions to run the kubectl command-line tool.
- Obtain access to a Manufacturing Connect Edge service account .json file, which you can get from mfgconnect\@litmus.io.
- Depending on the specific requirements of your environment, you may need to get access to a storage class. Learn more about [Storage Classes](https://kubernetes.io/docs/concepts/storage/storage-classes/) from the Kubernetes documentation.
- For full DeviceHub driver support, ensure your Linux host kernel is version 6 or higher

To use Kubernetes to install Manufacturing Connect Edge, you will need to do the following:

- Step 1: Launch a Manufacturing Connect Edge Kubernetes
- Step 2: Log in to Manufacturing Connect Edge

To jump to a specific section, refer to the Table of Contents on the right side and click the corresponding step.&#x20;

# Step 1: Launch a Manufacturing Connect Edge Kubernetes

**To launch a Manufacturing Connect Edge Kubernetes:**

1\. Request and download the service account .json file by sending an email to mfgconnect\@litmus.io.
2\. Open a Command Prompt Terminal (CTRL+R).
3\. Execute the following Linux commands to setup credentials for a Kubernetes namespace.

:::CodeblockTabs
```bash
kubectl create namespace imc-edge-prod
```

```powershell
kubectl create namespace imc-edge-prod
```
:::

The command creates a namespace named **imc-edge-prod**.

:::CodeblockTabs
```bash
kubectl create secret --namespace imc-edge-prod docker-registry imc-credential --docker-server=us-docker.pkg.dev --docker-username=_json_key --docker-password="$(cat ~/{file_name}.json)"
```

```powershell
# Change SA file from string to Base64:
$encodedPassword = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes((Get-Content -Raw ~\<file_name>.json)))
# Step to add secret:
kubectl create secret docker-registry imc-credential --namespace imc-edge-prod --docker-server=us-docker.pkg.dev --docker-username=_json_key --docker-password="$encodedPassword"

```
:::

:::hint{type="warning"}
**Important:&#x20;**&#x49;f you encounter an error as shown in the screenshot below when using Windows PowerShell, make sure to follow these steps:

- The namespace has been created
- There are no spaces in the command
- Replace the double quotes with single quotes

![](https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/mqH3oynyDLSb3oMY1BVal_image.png)
:::

Refer to the command parameters:

- `kubectl` create secret sets a Secret for use with a Docker registry.
- `--namespace imc-edge-prod` sets up a Kubernetes namespace of imc-edge-prod.
- `docker-registry imc-credential` sets up *Secret&#x20;*&#x6E;ame as `imc-credential`. This should not be changed.
- `--docker-server=us-docker.pkg.dev` sets the Docker registry server as `us-docker.pkg.dev`. This should not be changed.
- `--docker-username=_json_key` sets the Docker registry username to connect to the server above. This should not be changed.
- `--docker-password="$(cat ~/<file_name>.json)"` retrieves the password within the service account file requested from step 1.

:::hint{type="info"}
**Note:** imc-edge-prod should be changed to an isolated namespace to suit deployment best.
:::

:::hint{type="success"}
**Example:**  if the `.json` file is named `abc123.json`, execute: `kubectl create secret --namespace imc-edge-prod docker-registry imc-credential --docker-server=us-docker.pkg.dev --docker-username=_json_key --docker-password="$(cat ~/abc123.json)"`
:::

4\. Copy or download the following Manufacturing Connect Edge deployment file.&#x20;

::File{src="https://api.archbee.com/api/presign/SSUUxKZUk9bFTEPNn_6Zo/fQ8jUA6Kua30tai5zfW2e_mc-edge-deployment.yaml" label="mc-edge-deployment.yaml" uploadAsPublic="false"}

```yaml
# Create ServiceAccount
apiVersion: v1
kind: ServiceAccount
metadata:
  name: imc-edge-docker
  namespace: imc-edge-prod
  labels:
    app.kubernetes.io/name: imc-edge-docker
    app.kubernetes.io/instance: imc-edge-instance
---
# Create PVC
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: imc-edge-data
  namespace: imc-edge-prod
  labels:
    app.kubernetes.io/name: imc-edge-docker
    app.kubernetes.io/instance: imc-edge-instance
spec:
  accessModes:
    - "ReadWriteOnce"
  resources:
    requests:
      storage: "10G"
---
# Create Service
apiVersion: v1
kind: Service
metadata:
  name: imc-edge-docker
  namespace: imc-edge-prod
  labels:
    app.kubernetes.io/name: imc-edge-docker
    app.kubernetes.io/instance: imc-edge-instance
spec:
  type: ClusterIP
  ports:
    - port: 443
      targetPort: https
      protocol: TCP
      name: https
  selector:
    app.kubernetes.io/name: imc-edge-docker
    app.kubernetes.io/instance: imc-edge-instance
---
# Create Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  name: imc-edge-docker
  namespace: imc-edge-prod
  labels:
    app.kubernetes.io/name: imc-edge-docker
    app.kubernetes.io/instance: imc-edge-instance
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: imc-edge-docker
      app.kubernetes.io/instance: imc-edge-instance
  template:
    metadata:
      labels:
        app.kubernetes.io/name: imc-edge-docker
        app.kubernetes.io/instance: imc-edge-instance
    spec:
      serviceAccountName: imc-edge-docker
      securityContext:
        {}
      imagePullSecrets:
        - name: imc-credential
      containers:
        - name: imc-edge-docker
          securityContext:
            capabilities:
              add:
              - NET_ADMIN
          image: "us-docker.pkg.dev/litmus-customer-facing/imce-build/mce:latest"
          imagePullPolicy: IfNotPresent
          ports:
            - name: https
              containerPort: 443
              protocol: TCP
          volumeMounts:
            - mountPath: /var
              mountPropagation: 
              name: imc-edge-data
              subPath: 
              subPathExpr: 
          resources:
            requests:
              cpu: 1
              memory: 1024Mi
            limits:
              cpu: 4
              memory: 4096Mi
      volumes:
        - name: imc-edge-data
          persistentVolumeClaim:
            claimName: imc-edge-data
```

5\. Execute following command to deploy Manufacturing Connect Edge Kubernetes cluster using the deployment file from Step 4.

:::CodeblockTabs
```bash
kubectl apply -f mc-edge-deployment.yaml --namespace imc-edge-prod
```

```powershell
kubectl apply -f mc-edge-deployment.yaml --namespace imc-edge-prod
```
:::

Refer to the command parameters:

- `-f mc-edge-deployment.yaml` uses the file `mc-edge-deployment.yaml` for deployment. This should not be changed.
- `--namespace imc-edge-prod` sets` imc-edge-prod` to be the deployment that Kubernetes will use.

Special and Additional Considerations:

- Manufacturing Connect Edge can function in both single/multi Kubernetes node clusters, and can support various networking modes. Your Kubernetes admin has the responsibility to configure proper networking.​​
- Adjust CPU/RAM/Storage for the Kubernetes cluster as needed. Storage should be set to at least 10GB. Scale additional computing resources when using high-computing power Manufacturing Connect Edge features such as PLC drivers, CC, and Flows.
- Consult [Kubernetes official documentation](https://kubernetes.io/docs/home/) for best practices.
- Ensure credentials are stored properly with Kubernetes management​.
- `NET_ADMIN` permissions are required​.

# Step 2: Log in to Manufacturing Connect Edge

- See [Access the Manufacturing Connect Edge Web UI](docId\:O3eKDP0z_J7ItHAal0mwi) for details on logging in.&#x20;
- See [Access the Terminal User Interface](docId\:QsHf_W5ZqOfDe_xoZajrH) for instructions on how to navigate and log in for the first time.

:::hint{type="info"}
**Note:** To identify the port configured by the admin, use the following command: `kubectl get svc -n imc-edge-prod`
:::

