Kubernetes: Difference between revisions

From Skytech
Jump to navigation Jump to search
Created page with "Category: Linux = Petsets = <pre> Skip to content Personal Open source Business Explore Sign upSign inPricingBlogSupport This repository Search Watch 1,512 Star 18,56..."
 
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[ Category: Linux ]]
[[ Category:Linux ]]


= Petsets =
= How to access Pods externally =
* http://alesnosek.com/blog/2017/02/14/accessing-kubernetes-pods-from-outside-of-the-cluster/
 
= Disable some RBD features (or k8s will fail to launch pod) =
* fast-diff
* object-map
* deep-flatten
 
must all be disabled
<pre>
<pre>
Skip to content
rbd feature disable ssd/elasticsearch-data-01 fast-diff object-map deep-flatten
Personal Open source Business Explore
</pre>
Sign upSign inPricingBlogSupport
 
This repository
= RBD inside kubernetes =
Search
* https://github.com/kubernetes/examples/tree/master/staging/volumes/rbd
Watch 1,512  Star 18,562  Fork 6,134 kubernetes/kubernetes
 
Code  Issues 4,613  Pull requests 678  Projects 7  Wiki  Pulse  Graphs
Spent some time toying around with it but couldn't get it to work - it is a must to add the secret as described here: https://github.com/kubernetes/examples/tree/master/staging/volumes/rbd#use-ceph-authentication-secret and also add that part to the manifest:
Branch: master Find file Copy pathkubernetes/test/e2e/testing-manifests/petset/redis/petset.yaml
<pre>
f2bab13  4 days ago
...
@janetkuo janetkuo Remove 0 terminationGracePeriodSeconds from statefulset manifests
            user: admin
2 contributors @janetkuo @bprashanth
            keyring: /etc/ceph/ceph.client.admin.keyring
RawBlameHistory   
            secretRef:
98 lines (97 sloc)  2.66 KB
              name: ceph-secret
apiVersion: apps/v1beta1
...
kind: StatefulSet
</pre>
Link to example rbd manifest: https://github.com/kubernetes/examples/blob/master/staging/volumes/rbd/rbd.yaml
 
 
= Kube-dns - stub local DNS-servers with ip and zones =
<pre>
apiVersion: v1
kind: ConfigMap
metadata:
metadata:
  name: rd
    name: kube-dns
spec:
    namespace: kube-system
  serviceName: "redis"
data:
  replicas: 3
     stubDomains: |
  template:
         {"hq.skytech.dk": ["192.168.0.24", "10.0.0.24"]}
     metadata:
 
      labels:
         app: redis
      annotations:
        pod.alpha.kubernetes.io/initialized: "true"
        pod.alpha.kubernetes.io/init-containers: '[
            {
                "name": "install",
                "image": "gcr.io/google_containers/redis-install-3.2.0:e2e",
                "imagePullPolicy": "Always",
                "args": ["--install-into=/opt", "--work-dir=/work-dir"],
                "volumeMounts": [
                    {
                        "name": "opt",
                        "mountPath": "/opt"
                    },
                    {
                        "name": "workdir",
                        "mountPath": "/work-dir"
                    }
                ]
            },
            {
                "name": "bootstrap",
                "image": "debian:jessie",
                "command": ["/work-dir/peer-finder"],
                "args": ["-on-start=\"/work-dir/on-start.sh\"", "-service=redis"],
                "env": [
                  {
                      "name": "POD_NAMESPACE",
                      "valueFrom": {
                          "fieldRef": {
                              "apiVersion": "v1",
                              "fieldPath": "metadata.namespace"
                          }
                      }
                  }
                ],
                "volumeMounts": [
                    {
                        "name": "opt",
                        "mountPath": "/opt"
                    },
                    {
                        "name": "workdir",
                        "mountPath": "/work-dir"
                    }
                ]
            }
        ]'
    spec:
      containers:
      - name: redis
        image: debian:jessie
        ports:
        - containerPort: 6379
          name: peer
        command:
        - /opt/redis/redis-server
        args:
        - /opt/redis/redis.conf
        readinessProbe:
          exec:
            command:
            - sh
            - -c
            - "/opt/redis/redis-cli -h $(hostname) ping"
          initialDelaySeconds: 15
          timeoutSeconds: 5
        volumeMounts:
        - name: datadir
          mountPath: /data
        - name: opt
          mountPath: /opt
      volumes:
      - name: opt
        emptyDir: {}
      - name: workdir
        emptyDir: {}
  volumeClaimTemplates:
  - metadata:
      name: datadir
      annotations:
        volume.alpha.kubernetes.io/storage-class: anything
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 1Gi
</pre>
</pre>

Latest revision as of 09:17, 13 August 2019


How to access Pods externally

Disable some RBD features (or k8s will fail to launch pod)

  • fast-diff
  • object-map
  • deep-flatten

must all be disabled

rbd feature disable ssd/elasticsearch-data-01 fast-diff object-map deep-flatten

RBD inside kubernetes

Spent some time toying around with it but couldn't get it to work - it is a must to add the secret as described here: https://github.com/kubernetes/examples/tree/master/staging/volumes/rbd#use-ceph-authentication-secret and also add that part to the manifest:

...
            user: admin
            keyring: /etc/ceph/ceph.client.admin.keyring
            secretRef:
              name: ceph-secret
...

Link to example rbd manifest: https://github.com/kubernetes/examples/blob/master/staging/volumes/rbd/rbd.yaml


Kube-dns - stub local DNS-servers with ip and zones

apiVersion: v1
kind: ConfigMap
metadata:
    name: kube-dns
    namespace: kube-system
data:
    stubDomains: |
        {"hq.skytech.dk": ["192.168.0.24", "10.0.0.24"]}