Ahosti.Com
Read trending IT updates for cloud businesses, managed service providers, IT pros & what innovation digital transformation is driving in tech industry.

TKG in Azure – Half 4 : Create utility in workload cluster

0 5
[email protected] tkg % kubectl create ns bba-news
namespace/bba-news created

[email protected] tkg % kubectl get ns
NAME                        STATUS   AGE
bba-news                    Lively   78s
default                     Lively   21m
kube-node-lease             Lively   21m
kube-public                 Lively   21m
kube-system                 Lively   21m
tanzu-package-repo-global   Lively   20m
tkg-system                  Lively   20m
tkg-system-public           Lively   20m

Deployment:

apiVersion: apps/v1
type: Deployment
metadata:
  title: bbanews-deploy
  namespace: bba-news
spec:
  technique:
    kind: Recreate
  selector:
    matchLabels:
      app: bbanews
  replicas: 3 # tells deployment to run 1 pods matching the template
  template: # create pods utilizing pod definition on this template
    metadata:
      labels:
        app: bbanews
    spec:
      containers:
      - title: bbanews-con
        picture: eknath009/nginx-bbanews
        ports:
        - containerPort: 80

Service:

apiVersion: v1
type: Service
metadata:
  title: bbanews-svc
  namespace: bba-news
  labels:
    app: bbanews
spec:
  ports:
  - title: http
    port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: bbanews
  kind: LoadBalancer


[email protected] .ssh % kubectl apply -f bbanews_deploy.yaml
deployment.apps/bbanews-deploy created
[email protected] .ssh % kubectl apply -f bbanews_service.yaml
service/bbanews-svc created

[email protected] .ssh % kubectl get svc -n bba-news
NAME          TYPE           CLUSTER-IP       EXTERNAL-IP     PORT(S)        AGE
bbanews-svc   LoadBalancer   100.68.216.230   20.204.226.62   80:32489/TCP   6m24s
[email protected] .ssh % kubectl get deploy -n bba-news
NAME             READY   UP-TO-DATE   AVAILABLE   AGE
bbanews-deploy   3/3     3            3           15m

You might also like
Loading...