Kubernetes
Docker
Everything is based on your local environment
.NET Core
Use Docker to package and send your app
This sounds very similar to virtual machines
agile
FROM Microsoft /aspnetcore-build:2.0 AS build-env WORKDIR /app Copy csproj and restore AS distinct layers Copy *.csproj ./ RUN dotnet restore Copy everything else and build COPY . ./ RUN dotnet publish -c Release -o out Build runtime image FROM Microsoft /aspnetcore:2.0 WORKDIR /app COPY -- FROM =build-env /app/ out.entrypoint ["dotnet", "hello.dll"]Copy the code
docker build -t dotnetapp .
Copy the code
docker run -d -p 80:80 dotnetapp
Copy the code
Deploy and extend your application using Kubernetes
website
A tool for the same purpose
Minikube
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: dotnetapp
spec:
replicas: 3
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
minReadySeconds: 5
template:
metadata:
labels:
app: dotnetapp
spec:
containers:
- name: dotnetapp
image: johndoe/dotnetapp:1.0
ports:
- containerPort: 80
resources:
requests:
cpu: 250m
limits:
cpu: 500m
env:
- name: DB_ENDPOINT
value: "dotnetappdb"
apiVersion: v1
kind: Service
metadata:
name: dotnetapp
spec:
type: LoadBalancer
ports:
- port: 80
selector:
app: dotnetapp
Copy the code
kubectl apply -f .\dotnetapp-deployment.yaml
Copy the code
Deliver quickly, consistently and predictably
Original link:The Advantages of Using Kubernetes and Docker Together(Translated by Xiao Yuanhao)