Example deployment of a basic .net core API using HELM 3 ** Requires an install of Kubernetes - Docker Desktop can enable this by default in settings to give you an instance. ** Requires HELM
Helm is a package manager for Kubernetes. (k8s) It helps to easily pack, configure and deploy applications and services onto Kubernetes.
Using Charts, a collection of files inside a directory, packages can be created for one line installations, upgrades and rollbacks.
Recommended with chocolatey, if using windows.
choco install kubernetes-helm
Other options: Installation Options
helm create chart
##Chart.yaml
apiVersion: v2
name: test-app
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: "1.1.0"
defines values for the app. Here you can define the name of the Image for the container. The configuration values for Service and Ingress for the app and many other things.
# Default values for test-app.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: nginx
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
service:
type: ClusterIP
port: 80
ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80
nodeSelector: {}
tolerations: []
affinity: {}
Rename the repository to that of the build you are to create:
helmdemo
So when deployed, it will be looking for 'helmdemo:1.1.0' image if available.
image:
repository: helmdemo
pullPolicy: IfNotPresent
The service is defined to be ClusterIP type and exposes it’s port 80 to other Kubernetes objects. ClusterIP service can only be accessed from inside the cluster. You can change it to NodePort to be opened on the browser using this service. Other options include 'LoadBalancer';
service:
type: NodePort
port: 80
docker build -t helmdemo:1.1.0 -f .\HelmDeploymentDemo\Dockerfile .
Then in the helm chart folder, run the install command
helm install dockerhelmdemo .
See the pods
kubectl get pods
See the services
kubectl get services
This will show the port you can now hit the service on.
dockerhelmdemo2-hemldemo NodePort 10.111.70.212 <none> 80:32352/TCP 6m48s
http://localhost:32352/