Note: Follow the steps in this to install the agent on the docker image.
Add the following line to the end of your YAML file during container creation.
env:
- name: sname
value: <SERVERNAME>
Replace <SERVERNAME> with the desired name for container in Applicare. The <SERVERNAME> should be unique for each containers.
e.g.
apiVersion: apps/v1
kind: Deployment
metadata:
namespace : tomcat-ns1
name: app-deployment-1
spec:
replicas: 1
selector:
matchLabels:
app: tomcat
template:
metadata:
labels:
app: tomcat
spec:
containers:
- name: tomcat-container1
image: petstore:latest
imagePullPolicy: Never
ports:
- containerPort: 8080
env:
- name: sname
value: petstore
Assign a unique name to each Kubernetes container.
e.g.
apiVersion: apps/v1
kind: Deployment
metadata:
namespace : tomcat-ns1
name: app-deployment-1
spec:
replicas: 1
selector:
matchLabels:
app: tomcat
template:
metadata:
labels:
app: tomcat
spec:
containers:
- name: tomcat-container1
image: petstore:latest
imagePullPolicy: Never
ports:
- containerPort: 8080
env:
- name: sname
value: petstore1
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace : tomcat-ns1
name: app-deployment-2
spec:
replicas: 1
selector:
matchLabels:
app: tomcat
template:
metadata:
labels:
app: tomcat
spec:
containers:
- name: tomcat-container1
image: petstore:latest
imagePullPolicy: Never
ports:
- containerPort: 8080
env:
- name: sname
value: petstore2
---
apiVersion: v1
kind: Service
metadata:
namespace : tomcat-ns
name: tomcat-service-1
spec:
selector:
app: tomcat
ports:
- protocol: TCP
port: 81
targetPort: 8080
type: LoadBalancer
Comments
0 comments
Article is closed for comments.