-
Notifications
You must be signed in to change notification settings - Fork 0
Creating and Deploy Deployment and Service Configs
clydeu edited this page Oct 6, 2018
·
2 revisions
- Create deployment and service config.
- Apply deployment
kubectl create -f .\<deployment>.yml. - Apply service
kubectl create -f .\<service>.yml. - Update deployment or service using
kubectl apply -f <file>.yml.
- Monitoring commands:
-
kubectl get deployments- list all deployments -
kubectl get svc- list all services -
kubectl get pods- list all pods -
kubectl describe <pod>- get pod details
-
Use the --all-namespaces flag to list everything.
- Deleting commands:
kubectl delete deployment <deployment name>kubectl delete svc <service name>
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
labels:
app: myapp
spec:
replicas: 1
selector:
matchLabels:
app: myapp
template:
metadata:
labels:
app: myapp
spec:
containers:
- name: myapp
image: <docker repository>/<image>:<tag>
ports:
- containerPort: 80
env:
- name: "ASPNETCORE_ENVIRONMENT"
value: "Test"
imagePullSecrets:
- name: regcredkind: Service
apiVersion: v1
metadata:
name: myapp
labels:
app: myapp
spec:
selector:
app: myapp
ports:
- protocol: TCP
# Port accessible inside cluster
port: 8081
# Port to forward to inside the pod
targetPort: 80
# Port accessible outside cluster
nodePort: 30001
type: LoadBalancer