docker pull ramansharma95/webapp docker pull ramansharma95/mysql docker image tag ramansharma95/webapp user/webapp docker image tag rama...
docker pull ramansharma95/webapp
docker pull ramansharma95/mysql
docker image tag ramansharma95/webapp user/webapp
docker image tag ramansharma95/mysql user/mysql
helm create capstonepackage
cd capstonepackage/templates
rm * -ifr
Create a file deployweb.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-deploy
labels:
app: web-app
spec:
replicas: 3
template:
metadata:
labels:
app: web-app
spec:
containers:
- name: web-container
image: ramansharma95/webapp
ports:
- containerPort: 80
selector:
matchLabels:
app: web-app
Create a file deploydb.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: db-deploy
labels:
app: db-app
spec:
replicas: 1
template:
metadata:
labels:
app: db-app
spec:
containers:
- name: db-container
image: ramansharma95/mysql
ports:
- containerPort: 3306
selector:
matchLabels:
app: db-app
WebService serviceweb.yml
apiVersion: v1
kind: Service
metadata:
name: web-service
labels:
app: web-app
spec:
selector:
app: web-app
type: NodePort
ports:
- nodePort: 31111
port: 80
targetPort: 80
Service for db servicedb.yml
apiVersion: v1
kind: Service
metadata:
name: db
labels:
app: db-app
spec:
selector:
app: db-app
type: ClusterIP
ports:
- port: 3306
targetPort: 3306
cd ../../
Goto db pod (the name of the pod is different in your case so pickup that db pod)
kubectl get pods
kubectl exec -it db-deploy-74ffb848cf-hwmgf -- bash
mysql -uroot -pwhizlabs
create database company;
use company;
create table employee(name varchar(30), mobile varchar(20));
select * from employee;
COMMENTS