Container Images and Practical


Let me share few useful container images to play around with K8s

1. katacoda/docker-http-server
2. k8s.gcr.io/echoserver:1.10
3. nginx
4. busybox
- command: 
  - tail
  - -f
  - /dev/null
5. mendhak/http-https-echo
6.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: echoserver
spec:
  replicas: 3
  selector:
    matchLabels:
      app: echoserver
  template:
    metadata:
      labels:
        app: echoserver
    spec:
      containers:
      - image: gcr.io/google_containers/echoserver:1.0
        imagePullPolicy: Always
        name: echoserver
        ports:
        - containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: echoserver
spec:
  ports:
  - port: 80
    targetPort: 8080
    protocol: TCP
  selector:
    app: echoserver
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: echoserver
  annotations:
    kubernetes.io/ingress.class: "nginx"
spec:
  rules:
  - host: echo.example.com
    http:
      paths:
      - path: /
        backend:
          serviceName: echoserver
          servicePort: 80
---
7. curl
apiVersion: apps/v1 
kind: Deployment
metadata:
  name: client
  namespace: cli
spec:
  selector:
    matchLabels:
      app: cli
  replicas: 1
  template:
    metadata:
      labels:
        app: cli
    spec:
      containers:
      - name: client
        image: curlimages/curl:latest
        env:
        - name: ADDRESS
          value: "service_name.svc.cluster.local"
        command: [ "/bin/sh""-c""while true; do date; curl $ADDRESS 2>/dev/null | grep '<title>'; sleep 0.5; done;" ]

8. kubectl run -it --rm test --image=curlimages/curl --restart=Never -- /bin/sh

9. Docker Image: us-docker.pkg.dev/google-samples/containers/gke/hello-app:2.0

K8s microservice: kubectl expose deploy hw11 --port=80 --target-port=8080 --dry-run=client -o yaml

Script : please run in pod as per 8 above. 

while true; 
do curl n2iwf;
sleep 1; 
done

10. Echo server: hashicorp/http-echo:0.2.3 Port 5678

Here are example Dockerfiles

Here are few posts about hands on with K8s


0 comments:

Post a Comment